Source: libevent Version: 2.0.19-stable-3 Severity: normal Tags: upstream patch
Hi Anibal, Attached are two trivial tweaks [1] to free memory allocated inside routines. Explanations are in the patch headers proper. While they look trivial, I can quite judge the impact, since I don't have a clear idea how often are these called and fail to reclaim the allocated memory on bail-out. [1] I did dpkg-source --commit for you, please poke upstream, and add to series if you find them appropriate, also adjusting patch headers with the info further returned by BTS.
Description: free handle is request_new fails Trivial clean up on bailing out . libevent (2.0.19-stable-3) unstable; urgency=low . * [ceb52d98] DH compatibility level is 9 * [7792ab18] Support multiarch (Closes: #675320) Author: Anibal Monsalve Salazar <ani...@debian.org> Bug-Debian: http://bugs.debian.org/675320 --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: <vendor|upstream|other>, <url of original patch> Bug: <url in upstream bugtracker> Bug-Debian: http://bugs.debian.org/<bugnumber> Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> Forwarded: <no|not-needed|url proving that it has been forwarded> Reviewed-By: <name and email of someone who approved the patch> Last-Update: <YYYY-MM-DD> --- libevent-2.0.19-stable.orig/evdns.c +++ libevent-2.0.19-stable/evdns.c @@ -2291,7 +2291,10 @@ nameserver_send_probe(struct nameserver 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));
Description: free req when bailing out and returning NULL I can see the comment of uncertaincy /* XXX Should we dealloc req? If yes, how? */ but I think req should be nevertheless freed by mm_free() on bailing out and returning NULL from search_request_new(), as req was allocated by mm_malloc in request_new(). This is the trivial scoped cleaning. Further, the callers of search_request_new() are supposed to check its return value against NULL. Not done yet, but should trivial to add. . libevent (2.0.19-stable-3) unstable; urgency=low . * [ceb52d98] DH compatibility level is 9 * [7792ab18] Support multiarch (Closes: #675320) Author: Anibal Monsalve Salazar <ani...@debian.org> Bug-Debian: http://bugs.debian.org/675320 --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: <vendor|upstream|other>, <url of original patch> Bug: <url in upstream bugtracker> Bug-Debian: http://bugs.debian.org/<bugnumber> Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> Forwarded: <no|not-needed|url proving that it has been forwarded> Reviewed-By: <name and email of someone who approved the patch> Last-Update: <YYYY-MM-DD> --- libevent-2.0.19-stable.orig/evdns.c +++ libevent-2.0.19-stable/evdns.c @@ -3158,6 +3158,8 @@ search_request_new(struct evdns_base *ba handle->search_origname = mm_strdup(name); if (handle->search_origname == NULL) { /* XXX Should we dealloc req? If yes, how? */ + if (req) + mm_free(req); return NULL; } handle->search_state = base->global_search_state;