From 2aa632260bd958d5007d1ce81785ce9792dc8c6d Mon Sep 17 00:00:00 2001 From: Markus Valentin Date: Thu, 3 Mar 2022 14:21:00 +0100 Subject: [PATCH] imapc: imapc_connection_disconnect_full() - Only conditionally abort Only abort commands if there are no reconnect commands. Otherwise these still will be handled and the commands memory will be freed after handling them. Broken by 6d16e82fa2c352974558e1415d06f07d8962fe09 --- src/lib-imap-client/imapc-connection.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib-imap-client/imapc-connection.c b/src/lib-imap-client/imapc-connection.c index f8ae0ca5f6..8527817434 100644 --- a/src/lib-imap-client/imapc-connection.c +++ b/src/lib-imap-client/imapc-connection.c @@ -446,7 +446,9 @@ void imapc_connection_disconnect_full(struct imapc_connection *conn, if (conn->state == IMAPC_CONNECTION_STATE_DISCONNECTED) { i_assert(array_count(&conn->cmd_wait_list) == 0); - imapc_connection_abort_commands(conn, NULL, reconnecting); + if (conn->reconnect_command_count == 0) + imapc_connection_abort_commands(conn, NULL, + reconnecting); return; } -- 2.47.3