summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-07-23 12:19:46 +0930
committerAndrew Bartlett <abartlet@samba.org>2012-08-07 23:20:04 +1000
commit592e3f4b236b3b5c056faca6ca6f060560a3204d (patch)
treeac66d19f7388443c56be2d920982affa0f2a0a50
parent9b7b736e5b99c525d251942476ac94570aafb8e3 (diff)
downloadsamba-592e3f4b236b3b5c056faca6ca6f060560a3204d.tar.gz
samba-592e3f4b236b3b5c056faca6ca6f060560a3204d.tar.bz2
samba-592e3f4b236b3b5c056faca6ca6f060560a3204d.zip
loadparm: Add ctx member to struct loadparm_global.
Rather than tallocing global parameters off NULL, keep it neat by having a Global.ctx member. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--script/mkparamdefs.pl4
-rw-r--r--source3/param/loadparm.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/script/mkparamdefs.pl b/script/mkparamdefs.pl
index b489cc9277..6b59230b24 100644
--- a/script/mkparamdefs.pl
+++ b/script/mkparamdefs.pl
@@ -91,12 +91,14 @@ $file->("/* This file was automatically generated by mkparamdefs.pl. DO NOT EDIT
$file->(" * This structure describes global (ie., server-wide) parameters.\n");
$file->(" */\n");
$file->("struct loadparm_global \n");
+ $file->("{\n");
+ $file->("\tTALLOC_CTX *ctx; /* Context for talloced members */\n");
} elsif ($generate_scope eq "LOCAL") {
$file->(" * This structure describes a single service.\n");
$file->(" */\n");
$file->("struct loadparm_service \n");
+ $file->("{\n");
}
-$file->("{\n");
}
sub print_footer($$$)
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 1b766c3c46..1cbac61fcc 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -593,6 +593,7 @@ static void free_global_parameters(void)
{
free_param_opts(&Globals.param_opt);
free_parameters_by_snum(GLOBAL_SECTION_SNUM);
+ TALLOC_FREE(Globals.ctx);
}
static int map_parameter(const char *pszParmName);
@@ -690,6 +691,8 @@ static void init_globals(bool reinit_globals)
* table once the defaults are set */
ZERO_STRUCT(Globals);
+ Globals.ctx = talloc_new(NULL);
+
for (i = 0; parm_table[i].label; i++) {
if ((parm_table[i].type == P_STRING ||
parm_table[i].type == P_USTRING))