From f22049e35977f7974437ea251dfa0033497e046e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Aug 2013 19:17:08 -0400 Subject: [PATCH] Fix an unlikely but possible error case for http connections Found by coverity --- http.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/http.c b/http.c index 55190e26..7b5326c9 100644 --- a/http.c +++ b/http.c @@ -1419,6 +1419,12 @@ evhttp_connection_cb(struct bufferevent *bufev, short what, void *arg) return; } + if (evcon->fd == -1) { + event_debug(("%s: bufferevent_getfd returned -1", + __func__)); + goto cleanup; + } + /* Check if the connection completed */ if (getsockopt(evcon->fd, SOL_SOCKET, SO_ERROR, (void*)&error, &errsz) == -1) {