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)
committerJeremy Allison <jra@samba.org>
Thu, 26 Oct 2017 07:34:40 +0000 (09:34 +0200)
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>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 26 09:34:40 CEST 2017 on sn-devel-144

source3/modules/vfs_glusterfs.c

index 8d12ac65f026993d8ce915fc629141a12fcdfe52..32074cba4eb7c99851ca2ddd11b5d5e31f47bbe8 100644 (file)
@@ -1099,8 +1099,9 @@ static struct smb_filename *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;
        }
        smb_fname = synthetic_smb_fname(ctx,
                                        ret,