summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-01-24 12:26:17 +0000
committerJeremy Allison <jra@samba.org>1998-01-24 12:26:17 +0000
commit0c376c3ee726ba0c61f5537738041b5fe3d6e805 (patch)
treea9669de662405d826b9ea045a1dde87e98a10e77 /source3
parent4f650dab6f867bda2beeeda71b2b97e75834853f (diff)
downloadsamba-0c376c3ee726ba0c61f5537738041b5fe3d6e805.tar.gz
samba-0c376c3ee726ba0c61f5537738041b5fe3d6e805.tar.bz2
samba-0c376c3ee726ba0c61f5537738041b5fe3d6e805.zip
Fix for memory leak in loadparm.c - donated by Branko Cibej <branko.cibej@hermes.si>
I checked this out and it looks ok - the bzero() in init_service() was overwriting the pointers pservice->szService and pservice->copymap that should have been freed in copy_service() the line later. This fix frees pservice->szService and pservice->copymap inside free_service() and sets them to zero so they won't be freed again. Jeremy. (This used to be commit 0bcb00e2bad999df859fdff59ce720d34de9b1ad)
Diffstat (limited to 'source3')
-rw-r--r--source3/param/loadparm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index ac0f932fae..ad05b756aa 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1074,9 +1074,16 @@ static void free_service(service *pservice)
if (!pservice)
return;
+ string_free(&pservice->szService);
+ if (pservice->copymap)
+ {
+ free(pservice->copymap);
+ pservice->copymap = NULL;
+ }
+
for (i=0;parm_table[i].label;i++)
if ((parm_table[i].type == P_STRING ||
- parm_table[i].type == P_STRING) &&
+ parm_table[i].type == P_USTRING) &&
parm_table[i].class == P_LOCAL)
string_free((char **)(((char *)pservice) + PTR_DIFF(parm_table[i].ptr,&sDefault)));
}