changeset 22999:cee60b46c2f4

lib-master: ipc-client: Don't free command too early When multiple replies were received by IPC only the final reply should free the command. This may have caused e.g. "doveadm proxy list" to crash. Broken by 435f0545b200767c25a5daee17cd6b4998d03710
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 02 Oct 2018 10:22:11 +0300
parents 75d7b38afb60
children 88fe34445780
files src/lib-master/ipc-client.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-master/ipc-client.c	Thu Jul 05 14:55:38 2018 +0300
+++ b/src/lib-master/ipc-client.c	Tue Oct 02 10:22:11 2018 +0300
@@ -73,10 +73,10 @@
 		else
 			client->aborted_cmds_count--;
 	}
-	if (cmd != NULL) {
+	if (cmd != NULL)
 		cmd->callback(state, line, cmd->context);
+	if (state != IPC_CLIENT_CMD_STATE_REPLY)
 		i_free(cmd);
-	}
 	if (disconnect)
 		ipc_client_disconnect(client);
 }