summaryrefslogtreecommitdiff
path: root/intl/finddomain.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /intl/finddomain.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'intl/finddomain.c')
-rw-r--r--intl/finddomain.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/intl/finddomain.c b/intl/finddomain.c
index 9806ba12cd..39e54755d2 100644
--- a/intl/finddomain.c
+++ b/intl/finddomain.c
@@ -1,5 +1,5 @@
/* Handle list of needed message catalogs
- Copyright (C) 1995-1999, 2000, 2001, 2002, 2004, 2006
+ Copyright (C) 1995-1999, 2000, 2001, 2002, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -110,7 +110,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
break;
}
- return retval;
+ return cnt >= 0 ? retval : NULL;
/* NOTREACHED */
}
@@ -119,7 +119,20 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
done. */
alias_value = _nl_expand_alias (locale);
if (alias_value != NULL)
- locale = strdupa (alias_value);
+ {
+#if defined _LIBC || defined HAVE_STRDUP
+ locale = strdup (alias_value);
+ if (locale == NULL)
+ return NULL;
+#else
+ size_t len = strlen (alias_value) + 1;
+ locale = (char *) malloc (len);
+ if (locale == NULL)
+ return NULL;
+
+ memcpy (locale, alias_value, len);
+#endif
+ }
/* Now we determine the single parts of the locale name. First
look for the language. Termination symbols are `_' and `@' if
@@ -156,6 +169,10 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
}
}
+ /* The room for an alias was dynamically allocated. Free it now. */
+ if (alias_value != NULL)
+ free (locale);
+
/* The space for normalized_codeset is dynamically allocated. Free it. */
if (mask & XPG_NORM_CODESET)
free ((void *) normalized_codeset);