From: George Danchev Date: Thu, 13 Sep 2012 00:11:12 +0000 (-0400) Subject: Avoid a memory-leak on OOM in evdns. X-Git-Tag: release-2.0.21-stable~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73e85dd08fd3d9f3a98a30c9f9f9f46fee0d5e71;p=libevent Avoid a memory-leak on OOM in evdns. --- diff --git a/evdns.c b/evdns.c index e9cea45b..7b0fc2bd 100644 --- a/evdns.c +++ b/evdns.c @@ -2291,7 +2291,10 @@ nameserver_send_probe(struct nameserver *const ns) { handle = mm_calloc(1, sizeof(*handle)); if (!handle) return; req = request_new(ns->base, handle, TYPE_A, "google.com", DNS_QUERY_NO_SEARCH, nameserver_probe_callback, ns); - if (!req) return; + if (!req) { + mm_free(handle); + return; + } ns->probe_request = handle; /* we force this into the inflight queue no matter what */ request_trans_id_set(req, transaction_id_pick(ns->base));