diff options
author | Andrew Walker <awalker@ixsystems.com> | 2020-10-21 07:47:14 -0400 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-10-21 23:08:43 +0000 |
commit | 3b2a9083f8ea7758ab545ff82578ba35e1f05679 (patch) | |
tree | 34e61c90ef907fa860d47c96ec920a6c0ab736d6 /lib/param | |
parent | d031391bed0d3c23b602816d968417267535c746 (diff) | |
download | samba-3b2a9083f8ea7758ab545ff82578ba35e1f05679.tar.gz |
lib:util:loadparm - fix leak in lpcfg_dump_a_parameter
This function calls talloc_strdup() for the parm_name passed into
it so that we can check whether it's a parametric entry. It's
allocated under the loadparm context passed into the function.
Primary consumer of this is "testparm" and so context short-lived in
typical use-case, but this is also exposed via pyparam and so the
loadparm context may be somewhat longer-lived depending on how it is
being used.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14544
Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'lib/param')
-rw-r--r-- | lib/param/loadparm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 5309561b398..eaf992f209b 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -2408,11 +2408,14 @@ bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx, local_parm_name, parm_opt); if (parm_opt_value) { fprintf(f, "%s\n", parm_opt_value); + TALLOC_FREE(local_parm_name); return true; } } + TALLOC_FREE(local_parm_name); return false; } + TALLOC_FREE(local_parm_name); /* parameter is not parametric, search the table */ parm = lpcfg_parm_struct(lp_ctx, parm_name); |