r1224: Fix longstanding memleak bug with logfile name being set before lp_load()
authorJeremy Allison <jra@samba.org>
Wed, 23 Jun 2004 01:51:45 +0000 (01:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:01 +0000 (10:52 -0500)
loads the initial config file and overwrites the written logfile name with
zeros in init_globals(). Ensure we do a string_free() on Globals.szLogFile
if it isn't NULL.
Jeremy.
(This used to be commit c378f3c32533c085fef2c2e07f0660781a16a341)

source3/param/loadparm.c

index 247159a7b1047381cb5f85d01d9800c93f15a5a0..12bbebcaa809cf69b4aa9a14d18c259178b0f8e5 100644 (file)
@@ -1293,6 +1293,13 @@ static void init_globals(void)
 
        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++)