lib:util:loadparm - fix leak in lpcfg_dump_a_parameter
authorAndrew Walker <awalker@ixsystems.com>
Wed, 21 Oct 2020 11:47:14 +0000 (07:47 -0400)
committerJeremy Allison <jra@samba.org>
Wed, 21 Oct 2020 23:08:43 +0000 (23:08 +0000)
commit3b2a9083f8ea7758ab545ff82578ba35e1f05679
tree34e61c90ef907fa860d47c96ec920a6c0ab736d6
parentd031391bed0d3c23b602816d968417267535c746
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>
lib/param/loadparm.c