[PATCH] Fix double free in vfs_gluster_getwd()
Andreas Schneider
asn at samba.org
Thu Oct 26 06:06:42 UTC 2017
On Thursday, 26 October 2017 06:37:39 CEST Volker Lendecke wrote:
> On Wed, Oct 25, 2017 at 11:12:39AM -0700, Jeremy Allison via samba-technical
wrote:
> > On Wed, Oct 25, 2017 at 07:46:03PM +0200, Andreas Schneider wrote:
> > > Hi,
> > >
> > > the attached patch addresses a double free in vfs_glusterfs.
> > >
> > > Review and push much appreciated :-)
> >
> > Ooh - good catch ! RB+ and pushed.
>
> Wouldn't our pattern be a SAFE_FREE(cwd) instead of free(cwd) ?
That would be an additional patch just for master right?
See attached.
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
-------------- next part --------------
>From 6025e5f7d87715936742d5f4f0fd32ca93568823 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 26 Oct 2017 08:05:20 +0200
Subject: [PATCH] s3:vfs_glusterfs: Use SAFE_FREE
Signed-off-by: Andreas Schneider <asn at samba.org>
---
source3/modules/vfs_glusterfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 32074cba4eb..3534ed7027e 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1100,7 +1100,7 @@ static struct smb_filename *vfs_gluster_getwd(struct vfs_handle_struct *handle,
ret = glfs_getcwd(handle->data, cwd, PATH_MAX - 1);
if (ret == NULL) {
- free(cwd);
+ SAFE_FREE(cwd);
return NULL;
}
smb_fname = synthetic_smb_fname(ctx,
@@ -1108,7 +1108,7 @@ static struct smb_filename *vfs_gluster_getwd(struct vfs_handle_struct *handle,
NULL,
NULL,
0);
- free(cwd);
+ SAFE_FREE(cwd);
return smb_fname;
}
--
2.14.2
More information about the samba-technical
mailing list