From 7e876df71b5ac8355050018a0a130002a88801cb Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 13 May 2013 19:50:30 +0000 Subject: [PATCH] Fix dns/leak_resume_send_err test. 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/regress_dns.c b/test/regress_dns.c index babd90e5..7bf5fa70 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -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: -- 2.40.0