]> granicus.if.org Git - libevent/commitdiff
Fix dns/leak_resume_send_err test.
authorAzat Khuzhin <a3at.mail@gmail.com>
Mon, 13 May 2013 19:50:30 +0000 (19:50 +0000)
committerAzat Khuzhin <a3at.mail@gmail.com>
Mon, 13 May 2013 19:56:00 +0000 (19:56 +0000)
Because we don't cancel request,
and want our callback to recieve DNS_ERR_SHUTDOWN,
we use deferred callback, and there was
- one extra malloc(),
  @see reply_schedule_callback()
- and one missing free
  @see request_finished() (req->handle->pending_cb = 1)
than we don't need to count in testleak_cleanup()

So just decrement allocated_chunks to 2,
like we already take care about it.

test/regress_dns.c

index babd90e51b4d9992a2f4783e6575008d74a45245..7bf5fa707bc995683de30fa92f9b1285a3ecc12d 100644 (file)
@@ -1768,6 +1768,23 @@ dbg_leak_resume(void *env_, int cancel, int send_err_shutdown)
                tt_assert(!evdns_base_resume(env->dns_base));
        }
 
+       /**
+        * Because we don't cancel request,
+        * and want our callback to recieve DNS_ERR_SHUTDOWN,
+        * we use deferred callback, and there was
+        * - one extra malloc(),
+        *   @see reply_schedule_callback()
+        * - and one missing free
+        *   @see request_finished() (req->handle->pending_cb = 1)
+        * than we don't need to count in testleak_cleanup()
+        *
+        * So just decrement allocated_chunks to 2,
+        * like we already take care about it.
+        */
+       if (!cancel && send_err_shutdown) {
+               allocated_chunks -= 2;
+       }
+
        event_base_loop(env->base, EVLOOP_NONBLOCK);
 
 end: