]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
indexer: indexer_client_status_callback() - Fix accessing freed memory
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 11 Feb 2022 08:17:58 +0000 (09:17 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 21 Feb 2022 10:18:30 +0000 (10:18 +0000)
Broken by a9683d7b3

src/indexer/indexer-client.c

index bd65b5efc5e67806fe8a9ec4118b0199a086321e..ea557c0329667ac777816d6c753bc9c4614c6f3b 100644 (file)
@@ -138,14 +138,7 @@ void indexer_client_status_callback(int percentage, void *context)
 {
        struct indexer_client_request *ctx = context;
 
-       /* we are in deinit already, or the client has disconnected */
-       if (ctx->client->conn.output == NULL) {
-               indexer_client_unref(ctx->client);
-               i_free(ctx);
-               return;
-       }
-
-       T_BEGIN {
+       if (ctx->client->conn.output != NULL) T_BEGIN {
                o_stream_nsend_str(ctx->client->conn.output,
                        t_strdup_printf("%u\t%d\n", ctx->tag, percentage));
        } T_END;