]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: connection API - Add assert to make sure input is not NULL
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 24 Nov 2025 08:30:12 +0000 (10:30 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 24 Nov 2025 08:33:16 +0000 (10:33 +0200)
Some code, such as http_client_connection_start_tunnel(), can explicitly set
input/output to NULL to detach from the connection. However, they shouldn't
do it with client_connect_succeeded=FALSE stage.

Improvement to 95512b697fdbdd16d4112c6eec45ec4f3792485c

src/lib/connection.c

index 185f4d9afb4e29e89ec100c419039e7ae6ddbe48..2f2ffeb33a30ec8c7ffd4e4a34dfb0f6a5bad694 100644 (file)
@@ -1009,6 +1009,7 @@ const char *connection_disconnect_reason(struct connection *conn)
        case CONNECTION_DISCONNECT_CONN_CLOSED:
                if (!conn->client_connect_succeeded) {
                        /* connect() error is in the error istream */
+                       i_assert(conn->input != NULL);
                        return i_stream_get_error(conn->input);
                }
                /* fall through */