]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nss: Call __resolv_context_put before early return in get*_r [BZ #21932]
authorFlorian Weimer <fweimer@redhat.com>
Thu, 10 Aug 2017 07:10:36 +0000 (09:10 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 10 Aug 2017 07:10:36 +0000 (09:10 +0200)
This corrects an oversight introduced in commit
352f4ff9a268b81ef5d4b2413f582565806e4790 (resolv: Introduce struct
resolv_context).

(cherry picked from commit 3016149819268b14660f791b971910ccc2cc13e5)

ChangeLog
NEWS
nss/getXXbyYY_r.c

index 459062cc20310a42b4162fd70f3957a54fcf289c..312764862640f2bfe5549ade74710f85bd3271f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-09  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #21932]
+       * nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put
+       before early return.
+
 2017-08-09  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        [BZ #21780]
diff --git a/NEWS b/NEWS
index 9a645796580d904d20f2af5e7edceeccc7e1e6b7..ec6cf341226c6e940ad85a871d810041105575c4 100644 (file)
--- 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
 
index 6c547ea1ca6646c9b543fe1940da6514506570ce..bce80e05dd2d176467809faf353828f50cf76eaf 100644 (file)
@@ -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