about summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-08-09 17:46:04 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-08-09 17:47:11 +0200
commit3016149819268b14660f791b971910ccc2cc13e5 (patch)
treef772be326233b8217f7d88d3815154b4ed90ab6b /nss
parent756d1699896e62445196c3137a982a990a8e8847 (diff)
downloadglibc-3016149819268b14660f791b971910ccc2cc13e5.tar.gz
glibc-3016149819268b14660f791b971910ccc2cc13e5.tar.xz
glibc-3016149819268b14660f791b971910ccc2cc13e5.zip
nss: Call __resolv_context_put before early return in get*_r [BZ #21932]
This corrects an oversight introduced in commit
352f4ff9a268b81ef5d4b2413f582565806e4790 (resolv: Introduce struct
resolv_context).
Diffstat (limited to 'nss')
-rw-r--r--nss/getXXbyYY_r.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 6c547ea1ca..bce80e05dd 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