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.
This commit is contained in:
Roland McGrath 2002-08-15 21:58:11 +00:00
parent 2a76f7ef14
commit dac68e4c88

View File

@ -68,7 +68,7 @@ static struct stat64 archive_stat; /* stat of archive when header mapped. */
struct locale_in_archive struct locale_in_archive
{ {
struct locale_in_archive *next; struct locale_in_archive *next;
const char *name; char *name;
struct locale_data *data[__LC_LAST]; struct locale_data *data[__LC_LAST];
}; };
static struct locale_in_archive *archloaded; 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)) if (__builtin_expect (lia == NULL, 0))
return NULL; 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; lia->next = archloaded;
archloaded = lia; archloaded = lia;
@ -464,6 +470,7 @@ _nl_archive_subfreeres (void)
struct locale_in_archive *dead = lia; struct locale_in_archive *dead = lia;
lia = lia->next; lia = lia->next;
free (dead->name);
for (category = 0; category < __LC_LAST; ++category) for (category = 0; category < __LC_LAST; ++category)
if (category != LC_ALL) if (category != LC_ALL)
/* _nl_unload_locale just does this free for the archive case. */ /* _nl_unload_locale just does this free for the archive case. */