dovecot-2.2: lib-http: Reorder http_client_connection deinit cod...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 4 14:55:10 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/998afe8ffed9
changeset: 16152:998afe8ffed9
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 04 14:55:03 2013 +0300
description:
lib-http: Reorder http_client_connection deinit code just to be safe.
I'm not sure if this fixes any actual bugs, but just in case request
callbacks cause the connection to be accessed/modified in some way abort the
requests before doing anything else.

diffstat:

 src/lib-http/http-client-connection.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (39 lines):

diff -r 18a0b570df80 -r 998afe8ffed9 src/lib-http/http-client-connection.c
--- a/src/lib-http/http-client-connection.c	Thu Apr 04 14:51:20 2013 +0300
+++ b/src/lib-http/http-client-connection.c	Thu Apr 04 14:55:03 2013 +0300
@@ -831,10 +831,7 @@
 	conn->closing = TRUE;
 	conn->connected = FALSE;
 
-	if (conn->ssl_iostream != NULL)
-		ssl_iostream_unref(&conn->ssl_iostream);
-
-	connection_deinit(&conn->conn);
+	connection_disconnect(&conn->conn);
 
 	/* abort all pending requests */
 	array_foreach_modifiable(&conn->request_wait_list, req) {
@@ -844,6 +841,13 @@
 	}
 	array_free(&conn->request_wait_list);
 
+	if (conn->http_parser != NULL)
+		http_response_parser_deinit(&conn->http_parser);
+
+	if (conn->ssl_iostream != NULL)
+		ssl_iostream_unref(&conn->ssl_iostream);
+	connection_deinit(&conn->conn);
+
 	if (conn->to_input != NULL)
 		timeout_remove(&conn->to_input);
 	if (conn->to_idle != NULL)
@@ -860,9 +864,6 @@
 		}
 	}
 
-	if (conn->http_parser != NULL)
-		http_response_parser_deinit(&conn->http_parser);
-
 	i_free(conn);
 	*_conn = NULL;
 


More information about the dovecot-cvs mailing list