]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-connection - Call connnection_deinit() before conn_free() callb...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 9 Oct 2023 00:08:56 +0000 (02:08 +0200)
committerstephan.bosch <stephan.bosch@open-xchange.com>
Mon, 23 Oct 2023 15:50:54 +0000 (15:50 +0000)
The callback may destroy stuff that e.g. the event logging depends on. The
connection_deinit() call will cause event logging, which would cause trouble if
it is called after conn_free().

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

index aa6d8b0091eb8eb008833dbd51eeab6b2ae691f9..953b69afd68c14283b680c69b68dd036bd32c21c 100644 (file)
@@ -1120,11 +1120,11 @@ bool smtp_server_connection_unref(struct smtp_server_connection **_conn)
 
        e_debug(conn->event, "Connection destroy");
 
+       connection_deinit(&conn->conn);
+
        if (conn->callbacks != NULL && conn->callbacks->conn_free != NULL)
                conn->callbacks->conn_free(conn->context);
 
-       connection_deinit(&conn->conn);
-
        i_free(conn->proxy_helo);
        i_free(conn->helo_domain);
        i_free(conn->username);