diff options
author | Pierce Lopez <pierce.lopez@gmail.com> | 2015-01-28 13:37:16 -0500 |
---|---|---|
committer | Pierce Lopez <pierce.lopez@gmail.com> | 2015-01-28 13:37:16 -0500 |
commit | 46a1375b59c98f854a2bc629e0c8a1a6bed4434b (patch) | |
tree | 7509c725ef3f91619b5bb371100187f88ece1762 | |
parent | 2216a9bdba6252a0a7112cb0f6d8ec148178dbc0 (diff) | |
download | libevent-patches-1.4.tar.gz |
evhttp: fix leak from keep-alive disconnect or read/write timeoutpatches-1.4
When a keep-alive HTTP/1.1 connection disconnects, or when there's
a read or write timeout (default after 60 seconds), evhttp failed to
free the connection context memory.
-rw-r--r-- | http.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -695,9 +695,13 @@ void evhttp_write(int fd, short what, void *arg) { struct evhttp_connection *evcon = arg; + struct evhttp_request *req = TAILQ_FIRST(&evcon->requests); int n; if (what == EV_TIMEOUT) { + if (req != NULL) { + req->userdone = 1; + } evhttp_connection_fail(evcon, EVCON_HTTP_TIMEOUT); return; } @@ -935,6 +939,7 @@ evhttp_read(int fd, short what, void *arg) int n, len; if (what == EV_TIMEOUT) { + req->userdone = 1; evhttp_connection_fail(evcon, EVCON_HTTP_TIMEOUT); return; } @@ -2239,6 +2244,7 @@ evhttp_handle_request(struct evhttp_request *req, void *arg) if (req->uri == NULL) { event_debug(("%s: bad request", __func__)); if (req->evcon->state == EVCON_DISCONNECTED) { + req->userdone = 1; evhttp_connection_fail(req->evcon, EVCON_HTTP_EOF); } else { event_debug(("%s: sending error", __func__)); |