[metrics] fix memory leak

Each time Prometheus scraper queried the metrics, there was a memory
leak. Depending on the amount of metrics, this could amount to some
5MB/h of memory leakage (in case of a scrape every 10 second).
This commit is contained in:
Bostjan Meglic 2025-11-12 10:22:55 +01:00 committed by Sukchan Lee
parent 84ffa55039
commit 22ba9685ee

View file

@ -295,6 +295,7 @@ mhd_server_access_handler(void *cls, struct MHD_Connection *connection,
MHD_add_response_header(rsp, "Content-Type", "text/plain; version=0.0.4; charset=utf-8");
ret = MHD_queue_response(connection, MHD_HTTP_OK, rsp);
MHD_destroy_response(rsp);
prom_free((void *)buf);
return (_MHD_Result)ret;
}