From: Dave Hart Date: Fri, 15 Apr 2011 11:33:32 +0000 (+0000) Subject: libevent HEAD 20110415 11:33 UTC d28fc52815023113840fb9e108ada0126964a799 X-Git-Tag: NTP_4_2_7P153~2^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd787a227b4bea8d388ec3a5667f8a497a674f33;p=thirdparty%2Fntp.git libevent HEAD 20110415 11:33 UTC d28fc52815023113840fb9e108ada0126964a799 bk: 4da82d0cPQUMyiDAhC-5usMl7ho6vQ --- diff --git a/sntp/libevent/CommitLog b/sntp/libevent/CommitLog index 8d065e7fe..97a326206 100644 --- a/sntp/libevent/CommitLog +++ b/sntp/libevent/CommitLog @@ -1,3 +1,22 @@ +commit d28fc52815023113840fb9e108ada0126964a799 +Merge: bfdda26 2e9f665 +Author: Nick Mathewson +Date: Thu Apr 14 14:20:09 2011 -0400 + + Merge remote-tracking branch 'origin/patches-2.0' + +commit 2e9f66554897279f9aae2ce5a3933b99b6e08e38 +Author: Nick Mathewson +Date: Thu Apr 14 14:15:13 2011 -0400 + + Fix a couple of memory leaks in samples/http-server.c. Found by Dave Hart. + +commit 3417f6808d4c86b02148cde4f7a32b18d8d260b4 +Author: Nick Mathewson +Date: Wed Apr 13 11:20:30 2011 -0400 + + Avoid a free(NULL) if out-of-memory in evdns_getaddrinfo. Found by Dave Hart + commit bfdda26534ea66b847760720260a4b4d8fcefe58 Merge: d7c0ffa 1a21d7b Author: Nick Mathewson diff --git a/sntp/libevent/evdns.c b/sntp/libevent/evdns.c index 474a997ed..ab5dee615 100644 --- a/sntp/libevent/evdns.c +++ b/sntp/libevent/evdns.c @@ -4312,7 +4312,8 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count, evdns_cancel_request(NULL, other_req->r); } data->user_cb(EVUTIL_EAI_MEMORY, NULL, data->user_data); - evutil_freeaddrinfo(res); + if (res) + evutil_freeaddrinfo(res); if (other_req->r == NULL) free_getaddrinfo_request(data); diff --git a/sntp/libevent/sample/http-server.c b/sntp/libevent/sample/http-server.c index d5212c515..05dc165ec 100644 --- a/sntp/libevent/sample/http-server.c +++ b/sntp/libevent/sample/http-server.c @@ -144,7 +144,7 @@ dump_request_cb(struct evhttp_request *req, void *arg) static void send_document_cb(struct evhttp_request *req, void *arg) { - struct evbuffer *evb; + struct evbuffer *evb = NULL; const char *docroot = arg; const char *uri = evhttp_request_get_uri(req); struct evhttp_uri *decoded = NULL; @@ -229,7 +229,6 @@ send_document_cb(struct evhttp_request *req, void *arg) if (!(d = opendir(whole_path))) goto err; #endif - close(fd); evbuffer_add_printf(evb, "\n \n" " %s\n" @@ -286,18 +285,20 @@ send_document_cb(struct evhttp_request *req, void *arg) } evhttp_send_reply(req, 200, "OK", evb); - evbuffer_free(evb); - return; + goto done; err: evhttp_send_error(req, 404, "Document was not found"); if (fd>=0) close(fd); +done: if (decoded) evhttp_uri_free(decoded); if (decoded_path) free(decoded_path); if (whole_path) free(whole_path); + if (evb) + evbuffer_free(evb); } static void