If `dns_dnssec_keyfromrdata` failed we don't need to call
`dst_key_free` because no `dstkey` was created. Doing so
nevertheless will result in an assertion failure.
This can happen if the key uses an unsupported algorithm.
(cherry picked from commit
7a1ca39b950b7d5230b605ac60f15a1cb94e3d69)
dns_rdatatype_dnskey, dnskey, &buffer);
result = dns_dnssec_keyfromrdata(name, &rdata, mctx, &dstkey);
- if (result == ISC_R_SUCCESS)
+ if (result == ISC_R_SUCCESS) {
*tag = dst_key_id(dstkey);
- dst_key_free(&dstkey);
+ dst_key_free(&dstkey);
+ }
return (result);
}