]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Call request's destroy callback always, not just on success.
authorTimo Sirainen <tss@iki.fi>
Thu, 27 Jun 2013 17:28:51 +0000 (20:28 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 27 Jun 2013 17:28:51 +0000 (20:28 +0300)
src/lib-http/http-client-request.c

index 30bdafc81b53b6e623fc25dfdd22946786ae9f64..13c51267fd3746d7ddf15b11333ccef03c92d262 100644 (file)
@@ -92,6 +92,11 @@ void http_client_request_unref(struct http_client_request **_req)
        if (--req->refcount > 0)
                return;
 
+       if (req->destroy_callback != NULL) {
+               req->destroy_callback(req->destroy_context);
+               req->destroy_callback = NULL;
+       }
+
        /* only decrease pending request counter if this request was submitted */
        if (req->state > HTTP_REQUEST_STATE_NEW)
                req->client->pending_requests--;
@@ -541,9 +546,6 @@ void http_client_request_finish(struct http_client_request **_req)
        req->callback = NULL;
        req->state = HTTP_REQUEST_STATE_FINISHED;
 
-       if (req->destroy_callback != NULL)
-               req->destroy_callback(req->destroy_context);
-
        if (req->payload_wait && req->client->ioloop != NULL)
                io_loop_stop(req->client->ioloop);
        http_client_request_unref(_req);