From: Timo Sirainen Date: Thu, 14 Jul 2016 21:16:52 +0000 (-0500) Subject: dict: Fixed crash on iteration handling. X-Git-Tag: 2.3.0.rc1~3304 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab2f731c442a693897392f652ebbf9ddde1e5a27;p=thirdparty%2Fdovecot%2Fcore.git dict: Fixed crash on iteration handling. --- diff --git a/src/dict/dict-commands.c b/src/dict/dict-commands.c index 44ec866055..d769507a54 100644 --- a/src/dict/dict-commands.c +++ b/src/dict/dict-commands.c @@ -180,7 +180,6 @@ static int cmd_iterate_flush(struct dict_connection_cmd *cmd) cmd_stats_update(cmd, cmd_stats.iterations); cmd->reply = i_strdup(str_c(str)); - dict_connection_cmds_flush(cmd->conn); return 1; } @@ -491,8 +490,10 @@ static void dict_connection_cmd_output_more(struct dict_connection_cmd *cmd) struct dict_connection_cmd *const *first_cmdp; first_cmdp = array_idx(&cmd->conn->cmds, 0); - if (*first_cmdp == cmd) - (void)cmd_iterate_flush(cmd); + if (*first_cmdp == cmd) { + if (cmd_iterate_flush(cmd) > 0) + dict_connection_cmds_flush(cmd->conn); + } } void dict_connection_cmds_output_more(struct dict_connection *conn) @@ -511,6 +512,7 @@ void dict_connection_cmds_output_more(struct dict_connection *conn) /* unfinished */ break; } + dict_connection_cmds_flush(cmd->conn); /* cmd should be freed now */ } }