[2.26 COMMITTED] getaddrinfo: Release resolver context on error in gethosts [BZ #21885]

Florian Weimer fweimer@redhat.com
Sun Jan 1 00:00:00 GMT 2017


(cherry picked from commit 964263bb8d650f1681665c55704fb01a8e725621)

2017-08-03  Florian Weimer  <fweimer@redhat.com>

	[BZ #21885]
	* sysdeps/posix/getaddrinfo.c (gethosts): Release resolver context
	on memory allocation failure.

diff --git a/NEWS b/NEWS
index 8295f20..9a64579 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,12 @@ See the end for copying conditions.
 Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
 using `glibc' in the "product" field.
 
+Version 2.26.1
+
+The following bugs are resolved with this release:
+
+  [21885] getaddrinfo: Release resolver context on error in gethosts
+
 Version 2.26
 
 Major new features:
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index efa7118..699411c 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -255,6 +255,8 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
       break;								      \
     if (!scratch_buffer_grow (tmpbuf))					      \
       {									      \
+	__resolv_context_enable_inet6 (res_ctx, res_enable_inet6);	      \
+	__resolv_context_put (res_ctx);					      \
 	result = -EAI_MEMORY;						      \
 	goto free_and_return;						      \
       }									      \



More information about the Libc-stable mailing list