From: Andreas Schneider Date: Wed, 25 Oct 2017 17:39:34 +0000 (+0200) Subject: s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd() X-Git-Tag: samba-4.6.10~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b414d94fe7aa05d1fb3ca8ee35c346ca6797bae;p=thirdparty%2Fsamba.git s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd() Found by cppcheck. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13100 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 16389bed0773952ca563b7bf1fecc2a737587257) --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 2b6d827d21e..09e74ebde1f 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -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; }