When defaults->zonedir is set, opts->zonedir is unconditionally
overwritten without freeing the previous value. This leaks memory
on every catalog zone update when zonedir defaults are configured.
Free the existing opts->zonedir before replacing it.
(cherry picked from commit
5cd17c8adc2720b26e8d76599b7f7786f1c854ad)
}
if (defaults->zonedir != NULL) {
+ if (opts->zonedir != NULL) {
+ isc_mem_free(mctx, opts->zonedir);
+ }
opts->zonedir = isc_mem_strdup(mctx, defaults->zonedir);
}