]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix memory leak when reload_keep_cache is used and num-threads changes.
authorYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Fri, 31 May 2024 10:09:35 +0000 (12:09 +0200)
committerYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Fri, 31 May 2024 10:09:35 +0000 (12:09 +0200)
daemon/daemon.c

index f0ee329db90312fddc376599ab53b5947ad32640..dbb6db060c0ca4029a37ed1f210731ed0dd1ad60 100644 (file)
@@ -503,7 +503,10 @@ daemon_clear_allocs(struct daemon* daemon)
 {
        int i;
 
-       for(i=0; i<daemon->num; i++) {
+       /* daemon->num may be different during reloads (after configuration
+        * read). Use old_num which has the correct value used to setup the
+        * worker_allocs */
+       for(i=0; i<daemon->old_num; i++) {
                alloc_clear(daemon->worker_allocs[i]);
                free(daemon->worker_allocs[i]);
        }