mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
prevent memory leak in case cache isn't reused
This commit is contained in:
parent
5b2eda28e3
commit
fccb2eb2e8
1 changed files with 1 additions and 1 deletions
|
|
@ -788,13 +788,13 @@ daemon_cleanup(struct daemon* daemon)
|
||||||
worker_delete(daemon->workers[i]);
|
worker_delete(daemon->workers[i]);
|
||||||
free(daemon->workers);
|
free(daemon->workers);
|
||||||
daemon->workers = NULL;
|
daemon->workers = NULL;
|
||||||
daemon->num = 0;
|
|
||||||
/* Unless we're trying to keep the cache, worker alloc_caches should be
|
/* Unless we're trying to keep the cache, worker alloc_caches should be
|
||||||
* cleared and freed here. We do this after deleting workers to
|
* cleared and freed here. We do this after deleting workers to
|
||||||
* guarantee that the alloc caches are valid throughout the lifetime
|
* guarantee that the alloc caches are valid throughout the lifetime
|
||||||
* of workers. */
|
* of workers. */
|
||||||
if(!daemon->reuse_cache || daemon->need_to_exit)
|
if(!daemon->reuse_cache || daemon->need_to_exit)
|
||||||
daemon_clear_allocs(daemon);
|
daemon_clear_allocs(daemon);
|
||||||
|
daemon->num = 0;
|
||||||
#ifdef USE_DNSTAP
|
#ifdef USE_DNSTAP
|
||||||
dt_delete(daemon->dtenv);
|
dt_delete(daemon->dtenv);
|
||||||
daemon->dtenv = NULL;
|
daemon->dtenv = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue