summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-06-23 01:51:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:01 -0500
commitadf65489bd358c4da73d3e5f23365ee2596dbe6d (patch)
tree1c6c7087683798e717f0b950050a141fdf6a7a44
parent1f7dbded0435f4f6b3e141edb89025542b904a57 (diff)
downloadsamba-adf65489bd358c4da73d3e5f23365ee2596dbe6d.tar.gz
samba-adf65489bd358c4da73d3e5f23365ee2596dbe6d.tar.bz2
samba-adf65489bd358c4da73d3e5f23365ee2596dbe6d.zip
r1224: Fix longstanding memleak bug with logfile name being set before lp_load()
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)
-rw-r--r--source3/param/loadparm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 247159a7b1..12bbebcaa8 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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++)