2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Fix memory leak in dns_view_find; return DNS_R_HINTNXRRSET instead of

DNS_R_NOTFOUND when correct to do so.
This commit is contained in:
Brian Wellington
2000-12-20 23:31:11 +00:00
parent 24dc90eff0
commit 58cbc05eb0
5 changed files with 22 additions and 12 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: adb.c,v 1.161 2000/12/20 03:38:41 bwelling Exp $ */ /* $Id: adb.c,v 1.162 2000/12/20 23:31:04 bwelling Exp $ */
/* /*
* Implementation notes * Implementation notes
@@ -423,7 +423,8 @@ static isc_result_t dbfind_a6(dns_adbname_t *, isc_stdtime_t);
#define NXDOMAIN_RESULT(r) ((r) == DNS_R_NXDOMAIN || \ #define NXDOMAIN_RESULT(r) ((r) == DNS_R_NXDOMAIN || \
(r) == DNS_R_NCACHENXDOMAIN) (r) == DNS_R_NCACHENXDOMAIN)
#define NXRRSET_RESULT(r) ((r) == DNS_R_NCACHENXRRSET || \ #define NXRRSET_RESULT(r) ((r) == DNS_R_NCACHENXRRSET || \
(r) == DNS_R_NXRRSET) (r) == DNS_R_NXRRSET || \
(r) == DNS_R_HINTNXRRSET)
/* /*
* Error state rankings. * Error state rankings.

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: result.h,v 1.75 2000/12/13 00:15:38 tale Exp $ */ /* $Id: result.h,v 1.76 2000/12/20 23:31:10 bwelling Exp $ */
#ifndef DNS_RESULT_H #ifndef DNS_RESULT_H
#define DNS_RESULT_H 1 #define DNS_RESULT_H 1
@@ -109,8 +109,9 @@
#define DNS_R_METATYPE (ISC_RESULTCLASS_DNS + 70) #define DNS_R_METATYPE (ISC_RESULTCLASS_DNS + 70)
#define DNS_R_CNAMEANDOTHER (ISC_RESULTCLASS_DNS + 71) #define DNS_R_CNAMEANDOTHER (ISC_RESULTCLASS_DNS + 71)
#define DNS_R_SINGLETON (ISC_RESULTCLASS_DNS + 72) #define DNS_R_SINGLETON (ISC_RESULTCLASS_DNS + 72)
#define DNS_R_HINTNXRRSET (ISC_RESULTCLASS_DNS + 73)
#define DNS_R_NRESULTS 73 /* Number of results */ #define DNS_R_NRESULTS 74 /* Number of results */
/* /*
* DNS wire format rcodes. * DNS wire format rcodes.

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: view.h,v 1.60 2000/12/20 03:38:46 bwelling Exp $ */ /* $Id: view.h,v 1.61 2000/12/20 23:31:11 bwelling Exp $ */
#ifndef DNS_VIEW_H #ifndef DNS_VIEW_H
#define DNS_VIEW_H 1 #define DNS_VIEW_H 1
@@ -394,7 +394,9 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* *
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then * If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last. If the answer is found in the hints * it will be searched last. If the answer is found in the hints
* database, the result code will be DNS_R_HINT. * database, the result code will be DNS_R_HINT. If the name is found
* in the hints database but not the type, the result code will be
* DNS_R_HINTNXRRSET.
* *
* 'foundname' must meet the requirements of dns_db_find(). * 'foundname' must meet the requirements of dns_db_find().
* *
@@ -460,7 +462,9 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* *
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then * If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last. If the answer is found in the hints * it will be searched last. If the answer is found in the hints
* database, the result code will be DNS_R_HINT. * database, the result code will be DNS_R_HINT. If the name is found
* in the hints database but not the type, the result code will be
* DNS_R_HINTNXRRSET.
* *
* If 'sigrdataset' is not NULL, and there is a SIG rdataset which * If 'sigrdataset' is not NULL, and there is a SIG rdataset which
* covers 'type', then 'sigrdataset' will be bound to it. * covers 'type', then 'sigrdataset' will be bound to it.

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: result.c,v 1.83 2000/12/13 00:15:13 tale Exp $ */ /* $Id: result.c,v 1.84 2000/12/20 23:31:05 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -112,7 +112,8 @@ static const char *text[DNS_R_NRESULTS] = {
"invalid use of a meta type", /* 70 DNS_R_METATYPE */ "invalid use of a meta type", /* 70 DNS_R_METATYPE */
"CNAME and other data", /* 71 DNS_R_CNAMEANDOTHER */ "CNAME and other data", /* 71 DNS_R_CNAMEANDOTHER */
"multiple RRs of singleton type" /* 72 DNS_R_SINGLETON */ "multiple RRs of singleton type", /* 72 DNS_R_SINGLETON */
"hint nxrrset" /* 73 DNS_R_HINTNXRRSET */
}; };
static const char *rcode_text[DNS_R_NRCODERESULTS] = { static const char *rcode_text[DNS_R_NRCODERESULTS] = {

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: view.c,v 1.88 2000/12/20 03:38:43 bwelling Exp $ */ /* $Id: view.c,v 1.89 2000/12/20 23:31:06 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -759,8 +759,10 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
dns_resolver_prime(view->resolver); dns_resolver_prime(view->resolver);
dns_db_attach(view->hints, &db); dns_db_attach(view->hints, &db);
result = DNS_R_HINT; result = DNS_R_HINT;
} else if (result == DNS_R_NXDOMAIN || } else if (result == DNS_R_NXRRSET) {
result == DNS_R_NXRRSET) dns_db_attach(view->hints, &db);
result = DNS_R_HINTNXRRSET;
} else if (result == DNS_R_NXDOMAIN)
result = ISC_R_NOTFOUND; result = ISC_R_NOTFOUND;
} }
@@ -838,6 +840,7 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
result != DNS_R_NCACHENXDOMAIN && result != DNS_R_NCACHENXDOMAIN &&
result != DNS_R_NCACHENXRRSET && result != DNS_R_NCACHENXRRSET &&
result != DNS_R_NXRRSET && result != DNS_R_NXRRSET &&
result != DNS_R_HINTNXRRSET &&
result != ISC_R_NOTFOUND) { result != ISC_R_NOTFOUND) {
if (dns_rdataset_isassociated(rdataset)) if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset); dns_rdataset_disassociate(rdataset);