From e5192fd309ea6dff739742e90a8a6d1c656a5ae5 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 15 May 2003 02:23:20 +0000 Subject: [PATCH] 1449. [bug] query_addbestns() didn't handle running out of memory gracefully. --- CHANGES | 5 ++++- bin/named/query.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 67ae9744e2..cd9539f91f 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ 1452. [bug] Bad #ifdef, ISC_RFC2335 -> ISC_RFC2535. +1449. [bug] query_addbestns() didn't handle running out of memory + gracefully. + 1448. [bug] Handle empty wildcards labels. 1439. [bug] Named could return NOERROR with certain NOTIFY @@ -87,7 +90,7 @@ 1333. [contrib] queryperf now reports a summary of returned rcodes (-c), rcodes are printed in mnemonic form (-v). -1219. [bug] Set AI_ADDRCONFIG when looking up addresses +1299. [bug] Set AI_ADDRCONFIG when looking up addresses via getaddrinfo() (affects dig, host, nslookup, rndc and nsupdate). diff --git a/bin/named/query.c b/bin/named/query.c index 9e15953ff8..11be67ce8f 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.198.2.11 2003/05/14 06:51:36 marka Exp $ */ +/* $Id: query.c,v 1.198.2.12 2003/05/15 02:23:20 marka Exp $ */ #include @@ -1934,7 +1934,9 @@ query_addbestns(ns_client_t *client) { zdb = db; zfname = fname; zrdataset = rdataset; + rdataset = NULL; zsigrdataset = sigrdataset; + sigrdataset = NULL; dns_db_detachnode(db, &node); version = NULL; db = NULL; @@ -1995,7 +1997,8 @@ query_addbestns(ns_client_t *client) { DNS_SECTION_AUTHORITY); cleanup: - query_putrdataset(client, &rdataset); + if (rdataset != NULL) + query_putrdataset(client, &rdataset); if (sigrdataset != NULL) query_putrdataset(client, &sigrdataset); if (fname != NULL) @@ -2698,7 +2701,9 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) zdb = db; zfname = fname; zrdataset = rdataset; + rdataset = NULL; zsigrdataset = sigrdataset; + sigrdataset = NULL; dns_db_detachnode(db, &node); version = NULL; db = NULL; @@ -3203,7 +3208,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) /* * General cleanup. */ - query_putrdataset(client, &rdataset); + if (rdataset != NULL) + query_putrdataset(client, &rdataset); if (sigrdataset != NULL) query_putrdataset(client, &sigrdataset); if (fname != NULL)