]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
libevent HEAD 20110415 11:33 UTC d28fc52815023113840fb9e108ada0126964a799
authorDave Hart <hart@ntp.org>
Fri, 15 Apr 2011 11:33:32 +0000 (11:33 +0000)
committerDave Hart <hart@ntp.org>
Fri, 15 Apr 2011 11:33:32 +0000 (11:33 +0000)
bk: 4da82d0cPQUMyiDAhC-5usMl7ho6vQ

sntp/libevent/CommitLog
sntp/libevent/evdns.c
sntp/libevent/sample/http-server.c

index 8d065e7fee6e9252acd6b989e42bbeac4dfdc8fd..97a326206b4bd03830e96f4446926076bfef4d61 100644 (file)
@@ -1,3 +1,22 @@
+commit d28fc52815023113840fb9e108ada0126964a799
+Merge: bfdda26 2e9f665
+Author: Nick Mathewson <nickm@torproject.org>
+Date:   Thu Apr 14 14:20:09 2011 -0400
+
+    Merge remote-tracking branch 'origin/patches-2.0'
+
+commit 2e9f66554897279f9aae2ce5a3933b99b6e08e38
+Author: Nick Mathewson <nickm@torproject.org>
+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 <nickm@torproject.org>
+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 <nickm@torproject.org>
index 474a997ed325e9d3453c259a757e8f46a41d26bb..ab5dee61546be3567f0ce31cbb15d09ca62d577e 100644 (file)
@@ -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);
index d5212c515a7302564b30cf905ce6232156f24810..05dc165ec8f105b9f37c1d89e8428d2506271e40 100644 (file)
@@ -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, "<html>\n <head>\n"
                    "  <title>%s</title>\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