]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()
authorAndreas Schneider <asn@samba.org>
Wed, 25 Oct 2017 17:39:34 +0000 (19:39 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 2 Nov 2017 12:01:22 +0000 (13:01 +0100)
Found by cppcheck.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13100

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 16389bed0773952ca563b7bf1fecc2a737587257)

source3/modules/vfs_glusterfs.c

index 2b6d827d21e26a9afbd4a2e3bf1f47b2f75e2dbf..09e74ebde1f42effdbf88343501e549fe60c75eb 100644 (file)
@@ -1093,8 +1093,9 @@ static char *vfs_gluster_getwd(struct vfs_handle_struct *handle)
        }
 
        ret = glfs_getcwd(handle->data, cwd, PATH_MAX - 1);
-       if (ret == 0) {
+       if (ret == NULL) {
                free(cwd);
+               return NULL;
        }
        return ret;
 }