From: Timo Sirainen Date: Wed, 19 Aug 2015 17:49:12 +0000 (+0300) Subject: imap: If command has no imap_parser, don't crash when freeing the command. X-Git-Tag: 2.2.19.rc1~211 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=495a74cd17afdb584ef2c6bd50ea77a8d0905121;p=thirdparty%2Fdovecot%2Fcore.git imap: If command has no imap_parser, don't crash when freeing the command. All the current commands have a parser though, so this doesn't actually fix anything. --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 4f12571853..e8d6ba0a4c 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -699,11 +699,13 @@ void client_command_free(struct client_command_context **_cmd) if (client->mailbox_change_lock == cmd) client->mailbox_change_lock = NULL; - if (client->free_parser == NULL) { - imap_parser_reset(cmd->parser); - client->free_parser = cmd->parser; - } else if (cmd->parser != NULL) { - imap_parser_unref(&cmd->parser); + if (cmd->parser != NULL) { + if (client->free_parser == NULL) { + imap_parser_reset(cmd->parser); + client->free_parser = cmd->parser; + } else { + imap_parser_unref(&cmd->parser); + } } client->command_queue_size--;