]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_10] Add DLZ db version to activeversions
authorEvan Hunt <each@isc.org>
Sun, 28 May 2017 21:30:36 +0000 (14:30 -0700)
committerEvan Hunt <each@isc.org>
Sun, 28 May 2017 21:30:36 +0000 (14:30 -0700)
4628. [bug] Fixed a potential reference leak in query_getdb().
[RT #45247]

(cherry picked from commit 594eadcc341bc29f5977a5f09d910132ea9bd244)

CHANGES
bin/named/query.c

diff --git a/CHANGES b/CHANGES
index d78ad6cf527a8b82c8cade9c0c233e4f57452e01..38580540f0838e1b66a738573c707777711461ff 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4628.  [bug]           Fixed a potential reference leak in query_getdb().
+                       [RT #45247]
+
 4627.  [func]          Deprecate 'dig +sit', it is replaced by 'dig +cookie'.
                        [RT #45245]
 
index 8f2d23a626a31668c6a65cf0fffa075dcb058fcf..d1bcb5c8c6e12ca2fbfa1b7bc5fedfc9bf647561 100644 (file)
@@ -698,7 +698,7 @@ ns_query_init(ns_client_t *client) {
        return (result);
 }
 
-static inline ns_dbversion_t *
+static ns_dbversion_t *
 query_findversion(ns_client_t *client, dns_db_t *db) {
        ns_dbversion_t *dbversion;
 
@@ -1180,6 +1180,8 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
                                             zonelabels, &cm, &ci, &tdbp);
                 /* If we successful, we found a better match. */
                if (tresult == ISC_R_SUCCESS) {
+                       ns_dbversion_t *dbversion;
+
                        /*
                         * If the previous search returned a zone, detach it.
                         */
@@ -1198,15 +1200,16 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
                         */
                        *versionp = NULL;
 
-                       /*
-                        * Get our database version.
-                        */
-                       dns_db_currentversion(tdbp, versionp);
-
-                       /*
-                        * Be sure to return our database.
-                        */
-                       *dbp = tdbp;
+                       dbversion = query_findversion(client, tdbp);
+                       if (dbversion == NULL) {
+                               result = ISC_R_NOMEMORY;
+                       } else {
+                               /*
+                                * Be sure to return our database.
+                                */
+                               *dbp = tdbp;
+                               *versionp = dbversion->version;
+                       }
 
                        /*
                         * We return a null zone, No stats for DLZ zones.