Fix a memory leak with the CivetWeb callbacks in telemetry

This commit is contained in:
Tim Wojtulewicz 2024-06-03 09:35:20 -07:00
parent 65678fbfdb
commit 32fe94f0f8

View file

@ -66,6 +66,9 @@ void Manager::InitPostScript() {
try {
prometheus_exposer = std::make_unique<prometheus::Exposer>(prometheus_url, 2, callbacks);
// CivetWeb stores a copy of the callbacks, so we're safe to delete the pointer here
delete callbacks;
} catch ( const CivetException& exc ) {
reporter->FatalError("Failed to setup Prometheus endpoint: %s\n", exc.what());
}