From 05cb799274ffcdab8a5da4acb850233747e65bc0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sat, 22 Aug 2020 14:55:46 +1000 Subject: [PATCH] Take complete ownership or *keyp before calling tsigkey_free. --- lib/dns/tsig.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 6357a3a486..09bd3f7774 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -19,11 +19,12 @@ #include #include #include +#include #include #include #include /* Required for HP/UX (and others?) */ -#include #include +#include #include @@ -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