Take complete ownership or *keyp before calling tsigkey_free.

This commit is contained in:
Mark Andrews
2020-09-08 09:25:43 +10:00
parent 8b80f40993
commit 05cb799274
+4 -4
View File
@@ -19,11 +19,12 @@
#include <isc/buffer.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/print.h>
#include <isc/refcount.h>
#include <isc/serial.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/util.h>
#include <isc/time.h>
#include <isc/util.h>
#include <pk11/site.h>
@@ -829,12 +830,11 @@ dns_tsigkey_detach(dns_tsigkey_t **keyp) {
REQUIRE(VALID_TSIG_KEY(*keyp));
key = *keyp;
isc_refcount_decrement(&key->refs, &refs);
*keyp = NULL;
isc_refcount_decrement(&key->refs, &refs);
if (refs == 0)
tsigkey_free(key);
*keyp = NULL;
}
void