From dc2fed13c8a98123ff20316428e41eada36c81e9 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. (cherry picked from commit 0d1ff7446dce7b0641f49ac55a008669838612cd) --- 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 f14d3fac531..f4d0661dcaf 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