]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
640. [bug] Memory leak in error path could cause
authorMark Andrews <marka@isc.org>
Wed, 27 Dec 2000 23:01:25 +0000 (23:01 +0000)
committerMark Andrews <marka@isc.org>
Wed, 27 Dec 2000 23:01:25 +0000 (23:01 +0000)
                        "mpctx->allocated == 0" failure. [RT #584]

CHANGES
bin/named/query.c

diff --git a/CHANGES b/CHANGES
index aed9c0f0958cba93a16b875e134af60bd524f948..525110afc0c620180c5249253d80b9a804a5e300 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+ 640.  [bug]           Memory leak in error path could cause
+                       "mpctx->allocated == 0" failure. [RT #584]
 
  639.  [bug]           Reading entropy from the keyboard would sometimes fail.
                        [RT #591]
index 48469a7800673e567a9c8d576a522db32df51ec1..910fb90e12362764535489faf8f322b95787f53e 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.162 2000/12/16 02:30:58 bwelling Exp $ */
+/* $Id: query.c,v 1.163 2000/12/27 23:01:25 marka Exp $ */
 
 #include <config.h>
 
@@ -2912,8 +2912,10 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
                if (result != ISC_R_SUCCESS)
                        goto cleanup;
                result = dns_rdataset_first(trdataset);
-               if (result != ISC_R_SUCCESS)
+               if (result != ISC_R_SUCCESS) {
+                       dns_message_puttempname(client->message, &tname);
                        goto cleanup;
+               }
                dns_rdataset_current(trdataset, &rdata);
                result = dns_rdata_tostruct(&rdata, &cname, NULL);
                dns_rdata_reset(&rdata);
@@ -2963,13 +2965,17 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
                if (result != ISC_R_SUCCESS)
                        goto cleanup;
                result = dns_rdataset_first(trdataset);
-               if (result != ISC_R_SUCCESS)
+               if (result != ISC_R_SUCCESS) {
+                       dns_message_puttempname(client->message, &tname);
                        goto cleanup;
+               }
                dns_rdataset_current(trdataset, &rdata);
                result = dns_rdata_tostruct(&rdata, &dname, NULL);
                dns_rdata_reset(&rdata);
-               if (result != ISC_R_SUCCESS)
+               if (result != ISC_R_SUCCESS) {
+                       dns_message_puttempname(client->message, &tname);
                        goto cleanup;
+               }
                dns_name_init(tname, NULL);
                dns_name_clone(&dname.dname, tname);
                dns_rdata_freestruct(&dname);
@@ -2980,15 +2986,21 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
                prefix = dns_fixedname_name(&fixed);
                result = dns_name_split(client->query.qname, nlabels, nbits,
                                        prefix, NULL);
-               if (result != ISC_R_SUCCESS)
+               if (result != ISC_R_SUCCESS) {
+                       dns_message_puttempname(client->message, &tname);
                        goto cleanup;
+               }
                INSIST(fname == NULL);
                dbuf = query_getnamebuf(client);
-               if (dbuf == NULL)
+               if (dbuf == NULL) {
+                       dns_message_puttempname(client->message, &tname);
                        goto cleanup;
+               }
                fname = query_newname(client, dbuf, &b);
-               if (fname == NULL)
+               if (fname == NULL) {
+                       dns_message_puttempname(client->message, &tname);
                        goto cleanup;
+               }
                result = dns_name_concatenate(prefix, tname, fname, NULL);
                if (result != ISC_R_SUCCESS) {
                        dns_message_puttempname(client->message, &tname);