mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
[9.20] fix: dev: Fix memory leak in dns_catz_options_setdefault() for zonedir
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. Backport of MR !11660 Merge branch 'backport-ondrej/fix-memory-leak-in-dns_catz_options_setdefault-9.20' into 'bind-9.20' See merge request isc-projects/bind9!11685
This commit is contained in:
commit
1844afec7b
1 changed files with 3 additions and 0 deletions
|
|
@ -225,6 +225,9 @@ dns_catz_options_setdefault(isc_mem_t *mctx, const dns_catz_options_t *defaults,
|
|||
}
|
||||
|
||||
if (defaults->zonedir != NULL) {
|
||||
if (opts->zonedir != NULL) {
|
||||
isc_mem_free(mctx, opts->zonedir);
|
||||
}
|
||||
opts->zonedir = isc_mem_strdup(mctx, defaults->zonedir);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue