about summary refs log tree commit diff
path: root/locale/freelocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/freelocale.c')
-rw-r--r--locale/freelocale.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/locale/freelocale.c b/locale/freelocale.c
index de7e554c84..2ba1432a27 100644
--- a/locale/freelocale.c
+++ b/locale/freelocale.c
@@ -38,9 +38,14 @@ __freelocale (__locale_t dataset)
   __libc_lock_lock (__libc_setlocale_lock);
 
   for (cnt = 0; cnt < __LC_LAST; ++cnt)
-    if (cnt != LC_ALL && dataset->__locales[cnt]->usage_count != UNDELETABLE)
-      /* We can remove the data.  */
-      _nl_remove_locale (cnt, dataset->__locales[cnt]);
+    if (cnt != LC_ALL)
+      {
+	if (dataset->__locales[cnt]->usage_count != UNDELETABLE)
+	  /* We can remove the data.  */
+	  _nl_remove_locale (cnt, dataset->__locales[cnt]);
+	if (dataset->__names[cnt] != _nl_C_name)
+	  free ((char *) dataset->__names[cnt]);
+      }
 
   /* Free the locale_t handle itself.  */
   free (dataset);