diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index ca81410089..803214c096 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -691,6 +691,10 @@ dst_key_fromnamedfile(const char *filename, const char *dirname, int type, } key->modified = false; + + if (dirname != NULL) { + key->directory = isc_mem_strdup(mctx, dirname); + } *keyp = key; key = NULL; @@ -1395,6 +1399,9 @@ dst_key_free(dst_key_t **keyp) { INSIST(key->func->destroy != NULL); key->func->destroy(key); } + if (key->directory != NULL) { + isc_mem_free(mctx, key->directory); + } if (key->engine != NULL) { isc_mem_free(mctx, key->engine); } diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h index a4fcc05bd8..7026e7ffae 100644 --- a/lib/dns/dst_internal.h +++ b/lib/dns/dst_internal.h @@ -91,6 +91,7 @@ struct dst_key { dns_rdataclass_t key_class; /*%< class of the key record */ dns_ttl_t key_ttl; /*%< default/initial dnskey ttl */ isc_mem_t *mctx; /*%< memory context */ + char *directory; /*%< key directory */ char *engine; /*%< engine name (HSM) */ char *label; /*%< engine label (HSM) */ char *object; /*%< engine object (HSM) */