about summary refs log tree commit diff
path: root/locale/loadarchive.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-15 21:58:11 +0000
committerRoland McGrath <roland@gnu.org>2002-08-15 21:58:11 +0000
commitdac68e4c8895630d9f1dbb342dea72493c81d911 (patch)
tree86cfdd619e4de2f0b1bcf37fcd58556fc62b85c6 /locale/loadarchive.c
parent2a76f7ef1477c3e33dce2d9d7c3005c660de18a0 (diff)
downloadglibc-dac68e4c8895630d9f1dbb342dea72493c81d911.tar.gz
glibc-dac68e4c8895630d9f1dbb342dea72493c81d911.tar.xz
glibc-dac68e4c8895630d9f1dbb342dea72493c81d911.zip
2002-08-15 Roland McGrath <roland@redhat.com>
	* locale/loadarchive.c (_nl_load_locale_from_archive) Store strdup of
	the name as passed, rather than the name in the archive dictionary.
Diffstat (limited to 'locale/loadarchive.c')
-rw-r--r--locale/loadarchive.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index 845b9b0774..d71ec88e8c 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -68,7 +68,7 @@ static struct stat64 archive_stat; /* stat of archive when header mapped.  */
 struct locale_in_archive
 {
   struct locale_in_archive *next;
-  const char *name;
+  char *name;
   struct locale_data *data[__LC_LAST];
 };
 static struct locale_in_archive *archloaded;
@@ -428,7 +428,13 @@ _nl_load_locale_from_archive (int category, const char **namep)
   if (__builtin_expect (lia == NULL, 0))
     return NULL;
 
-  lia->name = headmap.ptr + namehashtab[idx].name_offset;
+  lia->name = strdup (*namep);
+  if (__builtin_expect (lia->name == NULL, 0))
+    {
+      free (lia);
+      return NULL;
+    }
+
   lia->next = archloaded;
   archloaded = lia;
 
@@ -464,6 +470,7 @@ _nl_archive_subfreeres (void)
       struct locale_in_archive *dead = lia;
       lia = lia->next;
 
+      free (dead->name);
       for (category = 0; category < __LC_LAST; ++category)
 	if (category != LC_ALL)
 	  /* _nl_unload_locale just does this free for the archive case.  */