From: Timo Sirainen Date: Fri, 7 Mar 2025 11:14:49 +0000 (+0200) Subject: lib-http: Fix increasing memory usage in shared HTTP client context X-Git-Tag: 2.4.1~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea4c73f78b36fbd1310228dcfd0c318296882570;p=thirdparty%2Fdovecot%2Fcore.git lib-http: Fix increasing memory usage in shared HTTP client context Broken by 191da0e9f93362fbf1ba8af2461c7df984eb375b --- diff --git a/src/lib-http/http-client-private.h b/src/lib-http/http-client-private.h index 1920112687..73e99eacc1 100644 --- a/src/lib-http/http-client-private.h +++ b/src/lib-http/http-client-private.h @@ -401,7 +401,7 @@ struct http_client_context { struct ioloop *ioloop; struct dns_client *dns_client; - const char *dns_client_socket_path; + char *dns_client_socket_path; unsigned int dns_ttl_msecs; unsigned int dns_lookup_timeout_msecs; diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index f4e624e96f..3413743499 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -492,6 +492,7 @@ void http_client_context_unref(struct http_client_context **_cctx) connection_list_deinit(&cctx->conn_list); event_unref(&cctx->event); + i_free(cctx->dns_client_socket_path); pool_unref(&cctx->pool); } @@ -513,7 +514,7 @@ http_client_context_update_settings(struct http_client_context *cctx) /* Revert back to default settings */ cctx->dns_client = NULL; - cctx->dns_client_socket_path = NULL; + i_free(cctx->dns_client_socket_path); cctx->dns_ttl_msecs = UINT_MAX; cctx->dns_lookup_timeout_msecs = UINT_MAX; @@ -534,10 +535,10 @@ http_client_context_update_settings(struct http_client_context *cctx) if (client->set->dns_client_socket_path[0] == '/' || str_begins_with(client->set->dns_client_socket_path, "./")) { cctx->dns_client_socket_path = - p_strdup(cctx->pool, client->set->dns_client_socket_path); + i_strdup(client->set->dns_client_socket_path); } else { cctx->dns_client_socket_path = - p_strdup_printf(cctx->pool, "%s/%s", + i_strdup_printf("%s/%s", client->set->base_dir, client->set->dns_client_socket_path); }