Merge pull request #121 from azat/dns-regress-leaks

regress_dns: fix leaks in getaddrinfo_async{,_cancel_stress} tests
This commit is contained in:
Nick Mathewson 2014-03-26 11:02:52 -04:00
commit 6066f985cc

View File

@ -1563,7 +1563,8 @@ test_getaddrinfo_async(void *arg)
end: end:
if (local_outcome.ai) if (local_outcome.ai)
evutil_freeaddrinfo(local_outcome.ai); evutil_freeaddrinfo(local_outcome.ai);
for (i=0;i<10;++i) { #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
for (i=0;i<(int)ARRAY_SIZE(a_out);++i) {
if (a_out[i].ai) if (a_out[i].ai)
evutil_freeaddrinfo(a_out[i].ai); evutil_freeaddrinfo(a_out[i].ai);
} }
@ -1875,6 +1876,8 @@ end:
evdns_base_free(dns_base, 1); evdns_base_free(dns_base, 1);
if (server) if (server)
evdns_close_server_port(server); evdns_close_server_port(server);
if (base)
event_base_free(base);
if (fd >= 0) if (fd >= 0)
evutil_closesocket(fd); evutil_closesocket(fd);
} }