dovecot-2.2: lib-http: client: Fixed cleanup of remaining waitin...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 24 22:39:46 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/d913fe3a926a
changeset: 17999:d913fe3a926a
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Oct 25 01:38:42 2014 +0300
description:
lib-http: client: Fixed cleanup of remaining waiting requests at connection destroy.
Forgot to dereference the requests for the reference that the connection
itself holds for each waiting request.

diffstat:

 src/lib-http/http-client-connection.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 9c6318786455 -r d913fe3a926a src/lib-http/http-client-connection.c
--- a/src/lib-http/http-client-connection.c	Sat Oct 25 01:38:42 2014 +0300
+++ b/src/lib-http/http-client-connection.c	Sat Oct 25 01:38:42 2014 +0300
@@ -1265,18 +1265,24 @@
 
 	http_client_connection_disconnect(conn);
 
+	/* abort all pending requests (not supposed to happen here) */
 	if (array_is_created(&conn->request_wait_list)) {
-		/* abort all pending requests */
 		array_foreach_modifiable(&conn->request_wait_list, req) {
 			i_assert((*req)->submitted);
-			http_client_request_error(*req, HTTP_CLIENT_REQUEST_ERROR_ABORTED,
+			http_client_request_error(*req,
+				HTTP_CLIENT_REQUEST_ERROR_ABORTED,
 				"Aborting");
+			http_client_request_unref(req);
 		}
 		array_free(&conn->request_wait_list);
 	}
 	if (conn->pending_request != NULL) {
-		http_client_request_error(conn->pending_request,
-			HTTP_CLIENT_REQUEST_ERROR_ABORTED, "Aborting");
+		struct http_client_request *pending_req = conn->pending_request;
+		conn->pending_request = NULL;
+		http_client_request_error(pending_req,
+ 			HTTP_CLIENT_REQUEST_ERROR_ABORTED,
+			"Aborting");
+		http_client_request_unref(&pending_req);
 	}
 
 	if (conn->http_parser != NULL)


More information about the dovecot-cvs mailing list