This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix leak in gataddrinfo when /etc/nsswitch.conf is absent


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]