]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: ipc-client: Don't free command too early
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 2 Oct 2018 07:22:11 +0000 (10:22 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Nov 2018 11:10:20 +0000 (13:10 +0200)
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

src/lib-master/ipc-client.c

index 93a2351dc34ca1ef1a94cc7ff8b130f8bbe3c4ab..546a733446b7ca51a8e76f61d1774da48a29d62d 100644 (file)
@@ -73,10 +73,10 @@ static void ipc_client_input_line(struct ipc_client *client, const char *line)
                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);
 }