lib:param: Set a memory context for the globals if not initialized yet
authorAndreas Schneider <asn@samba.org>
Tue, 5 Sep 2023 08:07:59 +0000 (10:07 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 25 Oct 2023 22:23:37 +0000 (22:23 +0000)
commitd7a6488da81e6c48c435b8bedc8a38dbf87eb796
tree09ace6b6be254fd40818544848518a513bd309ca
parent0e45a0cec95da4173bfaf2084cf13fa5b84c4fde
lib:param: Set a memory context for the globals if not initialized yet

Typically once the smb.conf starts to be loaded,
loadparm_s3_init_globals() will be called and a memory context for
strings on the static Globals will be created.  But we might call
lpcfg_set_cmdline() before we load the smb.conf file, so we (via a
helper pointer) call loadparm_s3_init_globals() to get that
initialisation done earlier, ensuring that all allocations on Globals is
done on a memory context that we can later TALLOC_FREE() before exit().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/param/loadparm.c
lib/param/s3_param.h
source3/param/loadparm_ctx.c