From: Timo Sirainen Date: Thu, 14 Jul 2016 21:16:52 +0000 (-0500) Subject: dict: Fixed crash on iteration handling. X-Git-Tag: 2.2.26~476 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9dc6403b3e5338b48183885996532b1864eff919;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 7c19f468ea..1b36d4c2ae 100644 --- a/src/dict/dict-commands.c +++ b/src/dict/dict-commands.c @@ -173,7 +173,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; } @@ -495,8 +494,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) @@ -515,6 +516,7 @@ void dict_connection_cmds_output_more(struct dict_connection *conn) /* unfinished */ break; } + dict_connection_cmds_flush(cmd->conn); /* cmd should be freed now */ } }