]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Fixed reference counting for requests that are aborted due to havin...
authorStephan Bosch <stephan@dovecot.fi>
Thu, 19 May 2016 21:40:26 +0000 (23:40 +0200)
committerStephan Bosch <stephan@dovecot.fi>
Thu, 26 May 2016 01:05:44 +0000 (03:05 +0200)
src/lib-http/http-client-request.c

index bbb28fc036b8b667b4d9ef74952e9f4b264ce6fc..071f7ea54814a34c1d7f83f262a03419c9c49f8a 100644 (file)
@@ -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 */