[PATCH] s3: Fix possible mem leak|Resend due to Jeremy's request
Swen Schillig
swen at vnet.ibm.com
Mon Mar 19 09:48:48 UTC 2018
On Fri, 2018-03-09 at 10:34 +0100, Andreas Schneider wrote:
> On Friday, 9 March 2018 09:39:25 CET Swen Schillig wrote:
> > On Fri, 2018-03-09 at 08:56 +0100, Andreas Schneider wrote:
> > > On Tuesday, 6 March 2018 11:47:28 CET Swen Schillig via samba-
> > >
> > > technical wrote:
> > > > Please review ....and push.
> > >
> > > Please always use TALLOC_FREE() (uppercase)
> >
> > Fixed.
> >
> > Cheers Swen
>
> RB+
>
..and finally the last one.
Please review and push if OK.
Thanks in advance.
Cheers Swen.
-------------- next part --------------
From b9becb1ef87d3583071b8b499ba5f81b995576f6 Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Tue, 6 Mar 2018 10:35:32 +0100
Subject: [PATCH] s3: Fix possible mem leak
The call to full_path_tos() might allocate memory which needs to be free'd
once processign is done.
Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
---
source3/smbd/dir.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 23ab563e99b..9152e2d76f1 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -2032,24 +2032,29 @@ static int files_below_forall_fn(struct file_id fid,
/*
* Filter files above dirpath
*/
- return 0;
+ goto err_out;
}
if (fullpath[state->dirpath_len] != '/') {
/*
* Filter file that don't have a path separator at the end of
* dirpath's length
*/
- return 0;
+ goto err_out;
}
if (memcmp(state->dirpath, fullpath, state->dirpath_len) != 0) {
/*
* Not a parent
*/
- return 0;
+ goto err_out;
}
+ TALLOC_FREE(to_free);
return state->fn(fid, data, state->private_data);
+
+err_out:
+ TALLOC_FREE(to_free);
+ return 0;
}
static int files_below_forall(connection_struct *conn,
--
2.14.3
More information about the samba-technical
mailing list