summary refs log tree commit diff
path: root/locale/setlocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/setlocale.c')
-rw-r--r--locale/setlocale.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/locale/setlocale.c b/locale/setlocale.c
index ff7192f45d..3e63b25ac2 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -204,8 +204,7 @@ new_composite_name (int category, const char *newnames[LC_ALL])
 static inline void
 setname (int category, const char *name)
 {
-  if (_nl_current[category] == NULL
-      && _nl_current_names[category] != _nl_C_name)
+  if (_nl_current_names[category] != _nl_C_name)
     free ((void *) _nl_current_names[category]);
 
   _nl_current_names[category] = name;
@@ -351,6 +350,9 @@ setlocale (int category, const char *locale)
       /* Critical section left.  */
       __libc_lock_unlock (__libc_setlocale_lock);
 
+      /* Free the resources (the locale path variable.  */
+      free (locale_path);
+
       return composite;
     }
   else
@@ -395,6 +397,9 @@ setlocale (int category, const char *locale)
       /* Critical section left.  */
       __libc_lock_unlock (__libc_setlocale_lock);
 
+      /* Free the resources (the locale path variable.  */
+      free (locale_path);
+
       return (char *) newname;
     }
 }