aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-10 00:03:41 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-10 00:03:41 +0000
commite7c8359e431ef305fbc61e4b86af6353b4f39879 (patch)
treeaaaa18bbbddec4ffe6935c2e14c71d866b0fe7f6 /posix
parentbe434a72b023edab7851c13da8f0639e46ee4fa8 (diff)
downloadglibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar
glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar.gz
glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar.bz2
glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.zip
* posix/wordexp.c (w_addword): Free word if realloc fails and it
was allocated here. [Coverity CID 219] * posix/getconf.c (print_all): Free confstr data after printing. [Coverity CID 218] * sysdeps/posix/getaddrinfo.c (gaih_inet): Free canon string if list allocation fails. [Coverity CID 215] * nss/nsswitch.c (__nss_configure_lookup): Fix loop end condition. [Coverity CID 213] * argp/argp-help.c (hol_entry_cmp): Don't call canon_doc_option if string is NULL. [Coverity CID 212] * argp/Makefile: Add rules to build and run bug-argp1. * argp/bug-argp1.c: New file. * io/ftw.c (ftw_dir): Use __rawmemchr instead of strchr to find end of string. * stdlib/canonicalize.c (__realpath): Likewise. * locale/programs/ld-time.c (time_finish): Don't dereference NULL pointer. [Coverity CID 206] * elf/dl-dst.h (DL_DST_REQUIRED): Be prepared for missing link map in statically linked code. * elf/dl-load.c (_dl_dst_substitute): When replacing ORIGIN in statically built code, be prepared to have no link map. [Coverity CID 205] * argp/argp-help.c (fill_in_uparams): Handle STATE==NULL in dgettext calls. [Coverity CID 204] * argp/argp-help.c (struct uparams): Remove valid member. Change the one user. (uparam_names): Reduce size. Avoid relative relocations. Moved to read-only segment. (fill_in_uparams): Update for new layout. * sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Parameter can be assumed to always be != NULL. [Coverity CID 202] * argp/argp-help.c (hol_entry_help): Remove some dead code [Coverity CID 200]. * nis/nss_nis/nis-service.c (_nss_nis_getservbyport_r): Optimize away a few more unconditional yperr2nss calls. (_nss_nis_getservbyname_r): Likewise.
Diffstat (limited to 'posix')
-rw-r--r--posix/getconf.c1
-rw-r--r--posix/wordexp.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/posix/getconf.c b/posix/getconf.c
index 66e582e995..3c5ffe454c 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -981,6 +981,7 @@ print_all (const char *path)
if (confstr (c->call_name, cvalue, clen) != clen)
error (3, errno, "confstr");
printf ("%.*s\n", (int) clen, cvalue);
+ free (cvalue);
break;
}
}
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 2eb58089c4..8dc07067c0 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997-2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1997-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -166,6 +166,7 @@ w_addword (wordexp_t *pwordexp, char *word)
/* Add a word to the wordlist */
size_t num_p;
char **new_wordv;
+ bool allocated = false;
/* Internally, NULL acts like "". Convert NULLs to "" before
* the caller sees them.
@@ -175,6 +176,7 @@ w_addword (wordexp_t *pwordexp, char *word)
word = __strdup ("");
if (word == NULL)
goto no_space;
+ allocated = true;
}
num_p = 2 + pwordexp->we_wordc + pwordexp->we_offs;
@@ -187,6 +189,9 @@ w_addword (wordexp_t *pwordexp, char *word)
return 0;
}
+ if (allocated)
+ free (word);
+
no_space:
return WRDE_NOSPACE;
}