]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 31 Jan 2018 14:36:21 +0000 (16:36 +0200)
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 8ecefa090536534c754fae11b0ebcf8f5c4a94a1..a6da1fc5dcb50ad3fe0b80a2dc1e4d3b539c1cd8 100644 (file)
@@ -1690,6 +1690,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)
@@ -1714,6 +1717,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);
 }