diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d17fa16cbb..aaeafac21e 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4535,6 +4535,7 @@ static void init_globals(bool first_time_only) { static bool done_init = False; char *s = NULL; + int i; /* If requested to initialize only once and we've already done it... */ if (first_time_only && done_init) { @@ -4543,30 +4544,39 @@ static void init_globals(bool first_time_only) } if (!done_init) { - int i; - /* The logfile can be set before this is invoked. Free it if so. */ if (Globals.szLogFile != NULL) { string_free(&Globals.szLogFile); Globals.szLogFile = NULL; } - - memset((void *)&Globals, '\0', sizeof(Globals)); - - for (i = 0; parm_table[i].label; i++) + done_init = True; + } else { + for (i = 0; parm_table[i].label; i++) { if ((parm_table[i].type == P_STRING || parm_table[i].type == P_USTRING) && parm_table[i].ptr) - string_set((char **)parm_table[i].ptr, ""); - - string_set(&sDefault.fstype, FSTYPE_STRING); - string_set(&sDefault.szPrintjobUsername, "%U"); + { + string_free((char **)parm_table[i].ptr); + } + } + } - init_printer_values(&sDefault); + memset((void *)&Globals, '\0', sizeof(Globals)); - done_init = True; + for (i = 0; parm_table[i].label; i++) { + if ((parm_table[i].type == P_STRING || + parm_table[i].type == P_USTRING) && + parm_table[i].ptr) + { + string_set((char **)parm_table[i].ptr, ""); + } } + string_set(&sDefault.fstype, FSTYPE_STRING); + string_set(&sDefault.szPrintjobUsername, "%U"); + + init_printer_values(&sDefault); + DEBUG(3, ("Initialising global parameters\n")); |