[PATCH] Fix double free in vfs_gluster_getwd()
Andreas Schneider
asn at samba.org
Wed Oct 25 17:46:03 UTC 2017
Hi,
the attached patch addresses a double free in vfs_glusterfs.
Review and push much appreciated :-)
Thanks,
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
-------------- next part --------------
>From 7c56d48523d0d493bcbe019437ea0d7fcf439c00 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 25 Oct 2017 19:39:34 +0200
Subject: [PATCH] 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 <asn at samba.org>
---
source3/modules/vfs_glusterfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 8d12ac65f02..32074cba4eb 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -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,
--
2.14.2
More information about the samba-technical
mailing list