]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: If command has no imap_parser, don't crash when freeing the command.
authorTimo Sirainen <tss@iki.fi>
Wed, 19 Aug 2015 17:49:12 +0000 (20:49 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 19 Aug 2015 17:49:12 +0000 (20:49 +0300)
All the current commands have a parser though, so this doesn't actually fix
anything.

src/imap/imap-client.c

index 4f1257185393ecfc892399b6c133420d7ae76cef..e8d6ba0a4c07460a293c0b4ee7fca967903a92f8 100644 (file)
@@ -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--;