aboutsummaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-10 02:55:21 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-10 02:55:21 +0000
commit51e5926049360b991d71862e33a97fe1ead4d9a6 (patch)
tree3089a8fec8cd11641d803075a15c7bdb51f4976b /locale
parente7c8359e431ef305fbc61e4b86af6353b4f39879 (diff)
downloadglibc-51e5926049360b991d71862e33a97fe1ead4d9a6.zip
glibc-51e5926049360b991d71862e33a97fe1ead4d9a6.tar.gz
glibc-51e5926049360b991d71862e33a97fe1ead4d9a6.tar.bz2
* nis/nis_defaults.c (searchXYX): New functions. Used by both
searchgroup and searchowner. Significantly simplified. (__nis_default_owner): Remove duplication. Do not locally copy the string before duplicating it. (__nis_default_group): Likewise. * nis/nis_lookup.c (nis_lookup): After calling nis_free_directory, we must clear the variable before calling __nisfind_server. * nis/nis_lookup.c (nis_lookup): Always free memory allocated with nis_getnames. [Coverity CID 223] * locale/programs/locfile.c (locfile_read): Use alloca instead of xmalloc to allocate local repertoire name. [Coverity CID 222] * iconv/iconv_charmap.c (use_to_charmap): No need to dynamically allocate memory for the input to add_bytes. [Coverity CID 221] was allocated here. [Coverity CID 219, 220]
Diffstat (limited to 'locale')
-rw-r--r--locale/programs/locfile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index bc12fbb..ae8ce73 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -155,10 +155,11 @@ argument to `%s' must be a single character"),
if (repertoire_name == NULL)
{
- repertoire_name = memcpy (xmalloc (arg->val.str.lenmb + 1),
- arg->val.str.startmb,
- arg->val.str.lenmb);
- ((char *) repertoire_name)[arg->val.str.lenmb] = '\0';
+ char *newp = alloca (arg->val.str.lenmb + 1);
+
+ *((char *) mempcpy (newp, arg->val.str.startmb,
+ arg->val.str.lenmb)) = '\0';
+ repertoire_name = newp;
}
break;