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.3.0.rc1~3666 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43c49be6f1ca42b9284833b2297e72ea0393fc9c;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 bbb28fc036..071f7ea548 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -812,17 +812,17 @@ 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 */ *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 */