From: Mark Andrews Date: Thu, 27 Feb 2014 05:55:46 +0000 (+1100) Subject: 3761. [bug] Address dangling reference bug in dns_keytable_add. X-Git-Tag: v9.10.0b2~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96c17c5ecb012028ad9d66f93a252994c6ed035c;p=thirdparty%2Fbind9.git 3761. [bug] Address dangling reference bug in dns_keytable_add. [RT #35471] --- diff --git a/CHANGES b/CHANGES index f949607c231..41c7d8e51bd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3761. [bug] Address dangling reference bug in dns_keytable_add. + [RT #35471] + 3760. [bug] Improve SIT with native PKCS#11 and on Windows. [RT #35433] diff --git a/lib/dns/keytable.c b/lib/dns/keytable.c index c49847f326a..8c57d632cd4 100644 --- a/lib/dns/keytable.c +++ b/lib/dns/keytable.c @@ -174,6 +174,7 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed, for (k = node->data; k != NULL; k = k->next) { if (k->key == NULL) { k->key = *keyp; + *keyp = NULL; /* transfer ownership */ break; } if (dst_key_compare(k->key, *keyp) == ISC_TRUE) @@ -182,7 +183,7 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed, if (k == NULL) result = ISC_R_SUCCESS; - else + else if (*keyp != NULL) dst_key_free(keyp); }