diff options
author | Gerald Carter <jerry@samba.org> | 2006-04-08 17:25:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:55 -0500 |
commit | bbf666e447132a5f6b206ddf9ca918298b756392 (patch) | |
tree | 3cac70deddd159edbd7fb3aece639c48e9a5e67e /source3/lib/util_str.c | |
parent | c9c502442b40aba97de17456ba948effcdfa3d05 (diff) | |
download | samba-bbf666e447132a5f6b206ddf9ca918298b756392.tar.gz samba-bbf666e447132a5f6b206ddf9ca918298b756392.tar.bz2 samba-bbf666e447132a5f6b206ddf9ca918298b756392.zip |
r15003: patch based on code from Arkady Glabek <aglabek@centeris.com> to ensure that global memory is freed when unloading pam_winbind.so (needs more testing on non-linux platforms)
(This used to be commit 1e0b79e591d70352a96e0a0487d8f394dc7b36ba)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r-- | source3/lib/util_str.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 446a4a00a1..439cbea6d9 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -853,7 +853,7 @@ BOOL in_list(const char *s, const char *list, BOOL casesensitive) } /* this is used to prevent lots of mallocs of size 1 */ -static char *null_string = NULL; +static const char *null_string = ""; /** Set a string value, allocing the space for the string @@ -862,20 +862,14 @@ static char *null_string = NULL; static BOOL string_init(char **dest,const char *src) { size_t l; + if (!src) src = ""; l = strlen(src); if (l == 0) { - if (!null_string) { - if((null_string = (char *)SMB_MALLOC(1)) == NULL) { - DEBUG(0,("string_init: malloc fail for null_string.\n")); - return False; - } - *null_string = 0; - } - *dest = null_string; + *dest = CONST_DISCARD(char*, null_string); } else { (*dest) = SMB_STRDUP(src); if ((*dest) == NULL) { |