Mercurial > dovecot > core-2.2
changeset 22991:d8c1409c1ec1
lib-master: ipc-client: Don't call callback twice if IPC proxy sends invalid input
ipc_client_disconnect() called it once, and the second time was done with
the cmds[0] that was already removed from the array.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 05 Jul 2018 13:40:43 +0300 |
parents | 39eb7899c21d |
children | 9baff92c7a84 |
files | src/lib-master/ipc-client.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-master/ipc-client.c Wed Sep 05 19:34:20 2018 +0300 +++ b/src/lib-master/ipc-client.c Thu Jul 05 13:40:43 2018 +0300 @@ -36,6 +36,7 @@ const struct ipc_client_cmd *cmds; unsigned int count; enum ipc_client_cmd_state state; + bool disconnect = FALSE; cmds = array_get(&client->cmds, &count); if (count == 0) { @@ -56,7 +57,7 @@ default: i_error("IPC proxy sent invalid input: %s", line); line = "Invalid input"; - ipc_client_disconnect(client); + disconnect = TRUE; state = IPC_CLIENT_CMD_STATE_ERROR; break; } @@ -64,6 +65,8 @@ cmds[0].callback(state, line, cmds[0].context); if (state != IPC_CLIENT_CMD_STATE_REPLY) array_delete(&client->cmds, 0, 1); + if (disconnect) + ipc_client_disconnect(client); } static void ipc_client_input(struct ipc_client *client)