diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 00:03:41 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 00:03:41 +0000 |
commit | e7c8359e431ef305fbc61e4b86af6353b4f39879 (patch) | |
tree | aaaa18bbbddec4ffe6935c2e14c71d866b0fe7f6 /sysdeps | |
parent | be434a72b023edab7851c13da8f0639e46ee4fa8 (diff) | |
download | glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar.gz glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar.xz 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 'sysdeps')
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 11 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ifaddrs.c | 8 |
2 files changed, 12 insertions, 7 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index fc0928676d..224381c8db 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1042,12 +1042,16 @@ gaih_inet (const char *name, const struct gaih_service *service, else socklen = sizeof (struct sockaddr_in); + struct addrinfo *pai_1st = pai; for (st2 = st; st2 != NULL; st2 = st2->next) { struct addrinfo *ai; ai = *pai = malloc (sizeof (struct addrinfo) + socklen); if (ai == NULL) - return -EAI_MEMORY; + { + free ((char *) canon); + return -EAI_MEMORY; + } ai->ai_flags = req->ai_flags; ai->ai_family = family; @@ -1065,6 +1069,10 @@ gaih_inet (const char *name, const struct gaih_service *service, #endif /* _HAVE_SA_LEN */ ai->ai_addr->sa_family = family; + /* In case of an allocation error the list must be NULL + terminated. */ + ai->ai_next = NULL; + if (family == AF_INET6) { struct sockaddr_in6 *sin6p = @@ -1088,7 +1096,6 @@ gaih_inet (const char *name, const struct gaih_service *service, pai = &(ai->ai_next); } - *pai = NULL; ++*naddrs; diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index f743f702f0..e6720f0ca2 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -1,5 +1,5 @@ /* getifaddrs -- get names and addresses of all network interfaces - Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -358,8 +358,7 @@ getifaddrs (struct ifaddrs **ifap) ifa_data. */ int result = 0; - if (ifap) - *ifap = NULL; + *ifap = NULL; if (! __no_netlink_support && __netlink_open (&nh) < 0) { @@ -840,8 +839,7 @@ getifaddrs (struct ifaddrs **ifap) memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage)); } - if (ifap != NULL) - *ifap = &ifas[0].ifa; + *ifap = &ifas[0].ifa; exit_free: __netlink_free_handle (&nh); |