From: Timo Sirainen Date: Wed, 26 Jan 2022 18:28:33 +0000 (+0100) Subject: indexer: Fix memory leak - worker_requests were never freed X-Git-Tag: 2.3.19~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e0a1472928672e4aacbf080f48674c33ccf3bfd;p=thirdparty%2Fdovecot%2Fcore.git indexer: Fix memory leak - worker_requests were never freed Broken by 141766b24f885259508ae39f2e18811018373bc7 --- diff --git a/src/indexer/indexer.c b/src/indexer/indexer.c index 9c63d79c27..6175b5476b 100644 --- a/src/indexer/indexer.c +++ b/src/indexer/indexer.c @@ -11,11 +11,6 @@ #include "worker-pool.h" #include "worker-connection.h" -struct worker_request { - struct connection *conn; - struct indexer_request *request; -}; - static const struct master_service_settings *set; static struct indexer_queue *queue; static struct worker_pool *worker_pool; @@ -45,14 +40,8 @@ static void client_connected(struct master_service_connection *conn) static void worker_send_request(struct connection *conn, struct indexer_request *request) { - struct worker_request *wrequest; - - wrequest = i_new(struct worker_request, 1); - wrequest->conn = conn; - wrequest->request = request; - indexer_queue_request_work(request); - worker_connection_request(conn, request, wrequest); + worker_connection_request(conn, request); } static void queue_try_send_more(struct indexer_queue *queue) diff --git a/src/indexer/worker-connection.c b/src/indexer/worker-connection.c index 964865a6fc..19e2a4160f 100644 --- a/src/indexer/worker-connection.c +++ b/src/indexer/worker-connection.c @@ -114,14 +114,12 @@ unsigned int worker_connections_get_process_limit(void) } void worker_connection_request(struct connection *conn, - struct indexer_request *request, - void *context) + struct indexer_request *request) { struct worker_connection *worker = container_of(conn, struct worker_connection, conn); i_assert(worker_connection_is_connected(conn)); - i_assert(context != NULL); i_assert(request->index || request->optimize); if (worker->request_username == NULL) diff --git a/src/indexer/worker-connection.h b/src/indexer/worker-connection.h index e2818ce3d9..e664c7ea60 100644 --- a/src/indexer/worker-connection.h +++ b/src/indexer/worker-connection.h @@ -25,11 +25,10 @@ bool worker_connection_is_connected(struct connection *conn); unsigned int worker_connections_get_process_limit(void); /* Send a new indexing request for username+mailbox. The status callback is - called as necessary with the given context. Requests can be queued, but - only for the same username. */ + called as necessary. Requests can be queued, but only for the same + username. */ void worker_connection_request(struct connection *conn, - struct indexer_request *request, - void *context); + struct indexer_request *request); /* Returns username of the currently pending requests, or NULL if there are none. */ const char *worker_connection_get_username(struct connection *conn);