dovecot-2.2: lib-http: http-client: Fixed leak of ostream when r...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 15 03:38:25 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/0bcbc30b81b7
changeset: 16732:0bcbc30b81b7
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Sep 15 03:29:03 2013 +0300
description:
lib-http: http-client: Fixed leak of ostream when request was resubmitted upon 417 response regarding 100-continue.
This would only occur when the server refuses Expect: 100-continue with a
417 response. The payload_output stream would be overwritten without being
freed first.

diffstat:

 src/lib-http/http-client-request.c |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (33 lines):

diff -r abd565369b8f -r 0bcbc30b81b7 src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c	Sun Sep 15 03:28:21 2013 +0300
+++ b/src/lib-http/http-client-request.c	Sun Sep 15 03:29:03 2013 +0300
@@ -364,6 +364,7 @@
 	int ret = 0;
 
 	i_assert(!req->conn->output_locked);
+	i_assert(req->payload_output == NULL);
 
 	str_append(rtext, req->method);
 	str_append(rtext, " ");
@@ -594,6 +595,10 @@
 		}
 	}
 
+	/* drop payload output stream from previous attempt */
+	if (req->payload_output != NULL)
+		o_stream_unref(&req->payload_output);
+
 	newport = (url->have_port ? url->port : (url->have_ssl ? 443 : 80));
 	target = http_url_create_target(url);
 
@@ -663,6 +668,10 @@
 		}
 	}
 
+	/* drop payload output stream from previous attempt */
+	if (req->payload_output != NULL)
+		o_stream_unref(&req->payload_output);
+
 	req->conn = NULL;
 	req->peer = NULL;
 	req->state = HTTP_REQUEST_STATE_QUEUED;


More information about the dovecot-cvs mailing list