From 66f2bd91bb9d5f38bcefad1d70802cf59f05ffa8 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 27 Apr 2019 17:18:13 +0200 Subject: [PATCH] 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(-) diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp index 63f19827de3..63f4054f43d 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; } }