]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Fix increasing memory usage in shared HTTP client context
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 7 Mar 2025 11:14:49 +0000 (13:14 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sat, 8 Mar 2025 06:54:36 +0000 (06:54 +0000)
Broken by 191da0e9f93362fbf1ba8af2461c7df984eb375b

src/lib-http/http-client-private.h
src/lib-http/http-client.c

index 192011268702e797c38e5e977a82f7604ef85381..73e99eacc176f8c1286ddcb9eac3a5fa94ce1ae9 100644 (file)
@@ -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;
 
index f4e624e96f7614d9e4b96965630db5b849377d27..3413743499790db6c2db80ba2fdaf1cab24d1d67 100644 (file)
@@ -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);
                        }