1
0
mirror of https://github.com/dovecot/core.git synced 2026-10-23 22:08:58 +03:00

imap: LIST - Fix leaking mailbox list iterator if client disconnects

If writing a LIST reply line failed because the output stream was closed,
cmd_list_continue() returned without deinitializing the mailbox list
iterator. Besides leaking memory (around 75-140 kB per command with
150-600 folders), the iterator keeps references to the mailbox { }
settings of all autocreated mailboxes, which caused warnings when the
imap process exited:

  Warning: Leaked settings: mail-storage-settings.c:819

Broken by 69fe2beffa
This commit is contained in:
Timo Sirainen
2026-10-23 14:09:59 +00:00
committed by timo.sirainen
parent 12b56c9082
commit 0897fb182d

View File

@@ -318,8 +318,10 @@ static bool cmd_list_continue(struct client_command_context *cmd)
/* send LIST/LSUB response */
ret = client_send_line_next(ctx->cmd->client, str_c(str));
if (ret < 0)
if (ret < 0) {
(void)mailbox_list_iter_deinit(&ctx->list_iter);
return TRUE;
}
/* send optional responses (if any) */
if (list_has_options(ctx)) {