tests: gfapi/bug1291259.c should only call glfs_free() on success

In case glfs_h_poll_upcall() does not return success, the 'struct
glfs_upcall' would not have been allocated. A retry will be done and
glfs_free() is called on the unallocated structure. In case the pointer
does not point to NULL, glfs_free() will try to free up some random
area.

Change-Id: I38788d3bf22bbac3924f25edf45cd4a2637fa777
BUG: 1371540
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/15603
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
This commit is contained in:
Niels de Vos 2016-09-30 12:55:40 +02:00
parent daea58a51b
commit d73ca4a5bf
2 changed files with 4 additions and 4 deletions

View File

@ -161,8 +161,10 @@ retry:
if (!upcall_received)
sleep (1); /* glfs_h_poll_upcall() does not block */
glfs_free (cbk);
cbk = NULL;
if (!ret) {
glfs_free (cbk);
cbk = NULL;
}
}
if (!upcall_received) {

View File

@ -28,5 +28,3 @@ TEST $CLI volume stop $V0
TEST $CLI volume delete $V0
cleanup;
#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=1371540
#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=1371540