From: W.C.A. Wijngaards Date: Wed, 12 Feb 2020 10:49:26 +0000 (+0100) Subject: - Fix to clean memory leak of respip_addr.lock when ip_tree deleted. X-Git-Tag: release-1.10.0rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dcfe531e41fc48bc6352ba3b8a7a098a57d5407;p=thirdparty%2Funbound.git - Fix to clean memory leak of respip_addr.lock when ip_tree deleted. --- diff --git a/doc/Changelog b/doc/Changelog index dfa0ff001..0a7807ca1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Fix with libnettle make test with dsa disabled. - Fix contrib/fastrpz.patch to apply cleanly. Fix for serve-stale fixes, but it does not compile, conflicts with new rpz code. + - Fix to clean memory leak of respip_addr.lock when ip_tree deleted. 10 February 2020: George - Document 'ub_result.was_ratelimited' in libunbound. diff --git a/respip/respip.c b/respip/respip.c index e47171f85..e9b7d5dbf 100644 --- a/respip/respip.c +++ b/respip/respip.c @@ -69,12 +69,21 @@ respip_set_create(void) return set; } +/** helper traverse to delete resp_addr nodes */ +static void +resp_addr_del(rbnode_type* n, void* ATTR_UNUSED(arg)) +{ + struct resp_addr* r = (struct resp_addr*)n->key; + lock_rw_destroy(&r->lock); +} + void respip_set_delete(struct respip_set* set) { if(!set) return; lock_rw_destroy(&set->lock); + traverse_postorder(&set->ip_tree, resp_addr_del, NULL); regional_destroy(set->region); free(set); }