]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Fixed double unref of request when error occurs during http_client_...
authorStephan Bosch <stephan@rename-it.nl>
Mon, 2 Feb 2015 21:48:30 +0000 (23:48 +0200)
committerStephan Bosch <stephan@rename-it.nl>
Mon, 2 Feb 2015 21:48:30 +0000 (23:48 +0200)
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.

src/lib-http/http-client-request.c

index 9968310a389b19781f3c1e5dccc3eec4b329b102..b5bc6a47e36b28f42ffd1a0c410c7fed8ab50213 100644 (file)
@@ -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;