This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix leak in gataddrinfo when /etc/nsswitch.conf is absent
- From: Allan McRae <allan at archlinux dot org>
- To: libc-alpha at sourceware dot org
- Date: Tue, 10 Sep 2013 14:34:02 +1000
- Subject: [PATCH] Fix leak in gataddrinfo when /etc/nsswitch.conf is absent
- Authentication-results: sourceware.org; auth=none
From: Vinitha Vijayan <jiji.vinitha@gmail.com>
---
Patch submitted to the bug tracker without follow-up. Siddhesh gave it an
OK on the bug tracker. I believe this is too small to require a contributor
agreement.
OK to apply?
2013-09-10 Vinitha Vijayan <jiji.vinitha@gmail.com>
[BZ #15048]
* sysdeps/posix/getaddrinfo.c (gaih_inet): Fix memory leak.
sysdeps/posix/getaddrinfo.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index c0ded84..c9a97d4 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -797,9 +797,12 @@ gaih_inet (const char *name, const struct gaih_service *service,
nip = __nss_hosts_database;
}
else
- no_more = __nss_database_lookup ("hosts", NULL,
- "dns [!UNAVAIL=return] files",
- &nip);
+ {
+ no_more = __nss_database_lookup ("hosts", NULL,
+ "dns [!UNAVAIL=return] files",
+ &__nss_hosts_database);
+ nip = __nss_hosts_database;
+ }
/* Initialize configurations. */
if (__glibc_unlikely (!_res_hconf.initialized))
--
1.8.4