From: Azat Khuzhin Date: Tue, 19 May 2020 08:45:43 +0000 (+0300) Subject: http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eee26deed38fc7a6b6780b54628b007a2810efcd;p=libevent http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else) Refs: #182 --- diff --git a/http.c b/http.c index 15aac661..142c2e73 100644 --- a/http.c +++ b/http.c @@ -877,6 +877,11 @@ evhttp_connection_fail_(struct evhttp_connection *evcon, /* We are trying the next request that was queued on us */ if (TAILQ_FIRST(&evcon->requests) != NULL) evhttp_connection_connect_(evcon); + else + if ((evcon->flags & EVHTTP_CON_OUTGOING) && + (evcon->flags & EVHTTP_CON_AUTOFREE)) { + evhttp_connection_free(evcon); + } /* The call to evhttp_connection_reset_ overwrote errno. * Let's restore the original errno, so that the user's