svn commit: samba r16420 - in branches/SAMBA_3_0/source/lib: .
jra at samba.org
jra at samba.org
Tue Jun 20 18:14:34 GMT 2006
Author: jra
Date: 2006-06-20 18:14:33 +0000 (Tue, 20 Jun 2006)
New Revision: 16420
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16420
Log:
Fix Klocwork #1674. Null deref.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/util_unistr.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_unistr.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_unistr.c 2006-06-20 18:14:19 UTC (rev 16419)
+++ branches/SAMBA_3_0/source/lib/util_unistr.c 2006-06-20 18:14:33 UTC (rev 16420)
@@ -98,8 +98,10 @@
/* 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 @@
#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
}
More information about the samba-cvs
mailing list