From: Stephan Bosch Date: Mon, 2 Feb 2015 21:48:30 +0000 (+0200) Subject: lib-http: client: Fixed double unref of request when error occurs during http_client_... X-Git-Tag: 2.2.16.rc1~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e4cdaaf560cfa94bfc014ce8e1a52e4d0a85b48;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: Fixed double unref of request when error occurs during http_client_request_try_retry(). Much like when the request is first submitted, any errors that occur while attempting a retry from within the callback are now delayed in a zero timer. --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index 9968310a38..b5bc6a47e3 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -912,10 +912,11 @@ void http_client_request_error(struct http_client_request *req, if (req->queue != NULL) http_client_queue_drop_request(req->queue, req); - if (!req->submitted) { - /* we're still in http_client_request_submit(). delay - reporting the error, so the caller doesn't have to handle - immediate callbacks. */ + if (!req->submitted || + req->state == HTTP_REQUEST_STATE_GOT_RESPONSE) { + /* we're still in http_client_request_submit() or in the callback + during a retry attempt. delay reporting the error, so the caller + doesn't have to handle immediate or nested callbacks. */ i_assert(req->delayed_error == NULL); req->delayed_error = p_strdup(req->pool, error); req->delayed_error_status = status;