diff options
author | Jeremy Allison <jra@samba.org> | 2006-06-20 18:14:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:18:52 -0500 |
commit | dc36abe3a234ddf7973a3cc19c06d3cef17fa4e1 (patch) | |
tree | f6575bc5173fb5551f3e0f6b576bd542255fcf06 /source3/lib | |
parent | 0edf73c85a6cc5a615d60aaa615b06944fe71572 (diff) | |
download | samba-dc36abe3a234ddf7973a3cc19c06d3cef17fa4e1.tar.gz samba-dc36abe3a234ddf7973a3cc19c06d3cef17fa4e1.tar.bz2 samba-dc36abe3a234ddf7973a3cc19c06d3cef17fa4e1.zip |
r16420: Fix Klocwork #1674. Null deref.
Jeremy.
(This used to be commit f5dddf339ee3a867e21f34a81bd0b33195b7397d)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_unistr.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index eef484148d..a0015c265f 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -98,8 +98,10 @@ void load_case_tables(void) /* Get the name of the current locale. */ old_locale = setlocale(LC_ALL, NULL); - /* Save it as it is in static storage. */ - saved_locale = SMB_STRDUP(old_locale); + if (old_locale) { + /* Save it as it is in static storage. */ + saved_locale = SMB_STRDUP(old_locale); + } /* We set back the locale to C to get ASCII-compatible toupper/lower functions. */ setlocale(LC_ALL, "C"); @@ -139,8 +141,10 @@ void load_case_tables(void) #ifdef HAVE_SETLOCALE /* Restore the old locale. */ - setlocale (LC_ALL, saved_locale); - SAFE_FREE(saved_locale); + if (saved_locale) { + setlocale (LC_ALL, saved_locale); + SAFE_FREE(saved_locale); + } #endif } |