From: Wouter Wijngaards Date: Mon, 3 Sep 2007 09:45:18 +0000 (+0000) Subject: spurious memory leak (+364 bytes) removed during tcp timeout callback. X-Git-Tag: release-0.5~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb0deb130171d5631513137ff724717fc624fed2;p=thirdparty%2Funbound.git spurious memory leak (+364 bytes) removed during tcp timeout callback. git-svn-id: file:///svn/unbound/trunk@577 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 32a75d3eb..994543292 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,7 @@ validator. CNAME to a NXDOMAIN response was collated into a response with both a CNAME and the NXDOMAIN rcode. Added a test that the rcode is changed to NOERROR (because of the CNAME). + - timeout on tcp does not lead to spurious leakage detect. 31 August 2007: Wouter - can read bind trusted-keys { ... }; files, in a compatibility mode. diff --git a/services/outside_network.c b/services/outside_network.c index 6fee1fc13..e94840f04 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -173,8 +173,10 @@ use_free_buffer(struct outside_network* outnet) if(outnet->tcp_wait_last == w) outnet->tcp_wait_last = NULL; if(!outnet_tcp_take_into_use(w, w->pkt, w->pkt_len)) { - (void)(*w->cb)(NULL, w->cb_arg, NETEVENT_CLOSED, NULL); + comm_point_callback_t* cb = w->cb; + void* cb_arg = w->cb_arg; waiting_tcp_delete(w); + (void)(*cb)(NULL, cb_arg, NETEVENT_CLOSED, NULL); } } } @@ -712,6 +714,8 @@ outnet_tcptimer(void* arg) { struct waiting_tcp* w = (struct waiting_tcp*)arg; struct outside_network* outnet = w->outnet; + comm_point_callback_t* cb; + void* cb_arg; if(w->pkt) { /* it is on the waiting list */ struct waiting_tcp* p=outnet->tcp_wait_first, *prev=NULL; @@ -733,8 +737,10 @@ outnet_tcptimer(void* arg) pend->next_free = outnet->tcp_free; outnet->tcp_free = pend; } - (void)(*w->cb)(NULL, w->cb_arg, NETEVENT_TIMEOUT, NULL); + cb = w->cb; + cb_arg = w->cb_arg; waiting_tcp_delete(w); + (void)(*cb)(NULL, cb_arg, NETEVENT_TIMEOUT, NULL); use_free_buffer(outnet); }