isc_stdtime_get(&now);
if (dns_name_countlabels(principal) == 0U) {
- if (tsigkey != NULL)
+ if (tsigkey != NULL) {
dns_tsigkey_detach(&tsigkey);
+ }
} else if (tsigkey == NULL) {
#ifdef GSSAPI
OM_uint32 gret, minor, lifetime;
} else {
tkeyout->inception = tsigkey->inception;
tkeyout->expire = tsigkey->expire;
- dns_tsigkey_detach(&tsigkey);
}
if (outtoken) {
* we need to make sure the response is signed (see RFC 3645, Section
* 2.2).
*/
- if (tsigkey != NULL && msg->tsigkey == NULL && msg->sig0key == NULL) {
- dns_message_settsigkey(msg, tsigkey);
+ if (tsigkey != NULL) {
+ if (msg->tsigkey == NULL && msg->sig0key == NULL) {
+ dns_message_settsigkey(msg, tsigkey);
+ }
+ dns_tsigkey_detach(&tsigkey);
}
return (ISC_R_SUCCESS);