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