[PATCH] s3: Fix possible mem leak
Swen Schillig
swen at vnet.ibm.com
Fri Mar 9 08:39:25 UTC 2018
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
-------------- next part --------------
From a57512c6bbe8a9f654e2b11a85ed306462e13cb9 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 68dac783698..00bd84c4688 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