Fix possible nullptr dereference in evhttp_send_reply_end()

(The existing implementation had sanity-checking code for the case where
 its argument was NULL, but it erroneously dereferenced it before actually
 doing the sanity-check. --nickm)
This commit is contained in:
Felix Nawothnig 2010-05-30 03:17:48 +02:00 committed by Nick Mathewson
parent 17a8e2d72b
commit 29b2e233a7

4
http.c
View File

@ -2145,13 +2145,15 @@ void
evhttp_send_reply_end(struct evhttp_request *req)
{
struct evhttp_connection *evcon = req->evcon;
struct evbuffer *output = bufferevent_get_output(evcon->bufev);
struct evbuffer *output;
if (evcon == NULL) {
evhttp_request_free(req);
return;
}
output = bufferevent_get_output(evcon->bufev);
/* we expect no more calls form the user on this request */
req->userdone = 1;