]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Fix timeout leak sometimes occurring at unexpected remote disconnect.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 28 Jan 2018 10:44:26 +0000 (11:44 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 28 Jan 2018 10:47:43 +0000 (11:47 +0100)
While disconnected, newly submitted commands are queued, yet scheduled for
immediate failure. The timeout used for that was not cleaned up.

src/lib-smtp/smtp-client-connection.c

index 6f669bb3d7ad523511b7c29ff17d4a2c4810afc1..a6426720eb42b45dca7446acf63f0dcf5f7ad48a 100644 (file)
@@ -1692,6 +1692,9 @@ void smtp_client_connection_unref(struct smtp_client_connection **_conn)
        smtp_client_connection_clear_password(conn);
        smtp_client_connection_disconnect(conn);
 
+       /* could have been created while already disconnected */
+       timeout_remove(&conn->to_commands);
+
        smtp_client_connection_debug(conn, "Destroy");
 
        if (conn->reply_parser != NULL)
@@ -1716,6 +1719,10 @@ void smtp_client_connection_close(struct smtp_client_connection **_conn)
        conn->closed = TRUE;
 
        smtp_client_connection_disconnect(conn);
+
+       /* could have been created while already disconnected */
+       timeout_remove(&conn->to_commands);
+
        smtp_client_connection_unref(&conn);
 }