]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
spurious memory leak (+364 bytes) removed during tcp timeout callback.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 3 Sep 2007 09:45:18 +0000 (09:45 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 3 Sep 2007 09:45:18 +0000 (09:45 +0000)
git-svn-id: file:///svn/unbound/trunk@577 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/outside_network.c

index 32a75d3eb97dfd9a8ee31a08d041bac5a4a972a1..994543292dad4c5b9f079585a9f203e73781377e 100644 (file)
@@ -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. 
index 6fee1fc13a6ced4f17807d029bdcf94bdf3b0d5e..e94840f04680cd02703949395dee701d8eef01df 100644 (file)
@@ -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);
 }