From 0d1ff7446dce7b0641f49ac55a008669838612cd Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 27 Apr 2019 17:18:13 +0200 Subject: Shared/Metric: Fix a rare memory leak Fix a memory leak in Metric happening only when enabling/disabling Metric from configs at runtime, leaking the metric added between last SendBatch() call and the ScheduleSend() call in the same function. The only way to reproduce this is to actually freeze the thread calling SendBatch(), disable metric, reload config, unfreeze the thread. --- src/common/Metric/Metric.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp index 826bd2b1ae3..94ad282f5ea 100644 --- a/src/common/Metric/Metric.cpp +++ b/src/common/Metric/Metric.cpp @@ -209,7 +209,7 @@ void Metric::ScheduleSend() MetricData* data; // Clear the queue while (_queuedData.Dequeue(data)) - ; + delete data; } } -- cgit v1.2.3