From 7761d6f78bf31cae378e7150112d76c95f1b2285 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 25 Apr 2024 12:04:37 +0200 Subject: [PATCH] l_LegacyDowntimesCache: delete removed objects not to leak memory --- lib/icinga/downtime.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index 7b6c96206..ac71b86cf 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -147,6 +147,12 @@ void Downtime::Start(bool runtimeCreated) void Downtime::Stop(bool runtimeRemoved) { + { + std::unique_lock lock (l_DowntimeMutex); + + l_LegacyDowntimesCache.erase(GetLegacyId()); + } + GetCheckable()->UnregisterDowntime(this); Downtime::Ptr parent = GetByName(GetParent());