From caf1bd5c130c585576dd7af6da6dda09429612d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martti=20Rannanj=C3=A4rvi?= Date: Wed, 10 Aug 2016 15:40:23 +0300 Subject: [PATCH] lib-storage: don't crash when pop3c-client timeouts --- src/lib-storage/index/pop3c/pop3c-client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib-storage/index/pop3c/pop3c-client.c b/src/lib-storage/index/pop3c/pop3c-client.c index 9388568de6..0b5081e65d 100644 --- a/src/lib-storage/index/pop3c/pop3c-client.c +++ b/src/lib-storage/index/pop3c/pop3c-client.c @@ -871,6 +871,11 @@ int pop3c_client_cmd_stream(struct pop3c_client *client, const char *cmdline, struct pop3c_client_sync_cmd_ctx ctx; const char *reply; + if (client->state == POP3C_CLIENT_STATE_DISCONNECTED) { + *error_r = "Disconnected from server"; + return -1; + } + memset(&ctx, 0, sizeof(ctx)); *input_r = pop3c_client_cmd_stream_async(client, cmdline, pop3c_client_cmd_reply, &ctx); -- 2.47.3