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

CHANGES
bin/named/query.c

diff --git a/CHANGES b/CHANGES
index bd10be8cbcc66752a0d96827fcf4a6f0c39da1da..cdcb77c501cbc7a82e82347fc8d3d9dc758a4044 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4628.  [bug]           Fixed a potential reference leak in query_getdb().
+                       [RT #45247]
+
 4627.  [placeholder]
 
 4626.  [test]          Added more tests for handling of different record
index b3360d2abb8a1425119ba46577018f9fd3309754..97408258ba46a49d640aa9dd0b1b7027f2e8485a 100644 (file)
@@ -973,7 +973,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;
 
@@ -1476,6 +1476,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.
                         */
@@ -1494,15 +1496,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.