mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 19:52:07 -04:00
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. Merge branch 'ondrej/fix-memory-leak-in-dns_catz_options_setdefault' into 'main' See merge request isc-projects/bind9!11660
This commit is contained in:
commit
29790af335
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