public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [2.26 COMMITTED] nss: Call __resolv_context_put before early return in get*_r [BZ #21932]
@ 2017-01-01  0:00 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2017-01-01  0:00 UTC (permalink / raw)
  To: libc-stable

This corrects an oversight introduced in commit
352f4ff9a268b81ef5d4b2413f582565806e4790 (resolv: Introduce struct
resolv_context).

(cherry picked from commit 3016149819268b14660f791b971910ccc2cc13e5)

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

	[BZ #21932]
	* nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put
	before early return.

diff --git a/NEWS b/NEWS
index 9a64579..ec6cf34 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Version 2.26.1
 The following bugs are resolved with this release:
 
   [21885] getaddrinfo: Release resolver context on error in gethosts
+  [21932] Unpaired __resolv_context_get in generic get*_r implementation
 \f
 Version 2.26
 
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 6c547ea..bce80e0 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -234,6 +234,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 				      H_ERRNO_VAR_P))
     {
     case -1:
+# ifdef NEED__RES
+      __resolv_context_put (res_ctx);
+# endif
       return errno;
     case 1:
 #ifdef NEED_H_ERRNO
@@ -253,7 +256,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
       nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
 			       H_ERRNO_VAR);
       if (nscd_status >= 0)
-	return nscd_status;
+	{
+# ifdef NEED__RES
+	  __resolv_context_put (res_ctx);
+# endif
+	  return nscd_status;
+	}
     }
 #endif
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-10  7:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-01  0:00 [2.26 COMMITTED] nss: Call __resolv_context_put before early return in get*_r [BZ #21932] Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).