changeset 18983:637e005a5559

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.
author Timo Sirainen <tss@iki.fi>
date Wed, 19 Aug 2015 20:49:12 +0300
parents 84036f6687d5
children d26178d0557a
files src/imap/imap-client.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-client.c	Wed Aug 19 16:50:10 2015 +0300
+++ b/src/imap/imap-client.c	Wed Aug 19 20:49:12 2015 +0300
@@ -699,11 +699,13 @@
 	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--;