From: Stephan Bosch Date: Thu, 19 May 2016 21:40:26 +0000 (+0200) Subject: lib-http: client: Fixed reference counting for requests that are aborted due to havin... X-Git-Tag: 2.2.25.rc1~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=adc47546e129d4ded671dfb1bb7dc31c4823d5f8;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: Fixed reference counting for requests that are aborted due to having a broken outgoing payload stream. --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index cec9748c60..05890f512b 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -788,18 +788,18 @@ int http_client_request_send_more(struct http_client_request *req, o_stream_set_max_buffer_size(output, (size_t)-1); if (req->payload_input->stream_errno != 0) { - /* the payload stream assigned to this request is broken, - fail this the request immediately */ - http_client_request_send_error(req, - HTTP_CLIENT_REQUEST_ERROR_BROKEN_PAYLOAD, - "Broken payload stream"); - /* we're in the middle of sending a request, so the connection will also have to be aborted */ errno = req->payload_input->stream_errno; *error_r = t_strdup_printf("read(%s) failed: %s", i_stream_get_name(req->payload_input), i_stream_get_error(req->payload_input)); + + /* the payload stream assigned to this request is broken, + fail this the request immediately */ + http_client_request_error(&req, + HTTP_CLIENT_REQUEST_ERROR_BROKEN_PAYLOAD, + "Broken payload stream"); return -1; } else if (output->stream_errno != 0) { /* failed to send request */