From dd0f7f2885a2b86d99af7bf1180eca59defa60b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez?= Date: Mon, 30 Sep 2024 07:51:46 +0200 Subject: [PATCH] Fix memory leak deleting TypeLookupManager (#5273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- .../type_lookup_service/TypeLookupManager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp index a0ca795f5f3..8c3148c5aa0 100644 --- a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp +++ b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp @@ -101,6 +101,24 @@ TypeLookupManager::~TypeLookupManager() delete temp_reader_proxy_data_; delete temp_writer_proxy_data_; + + for (auto& writer_entry : async_get_type_writer_callbacks_) + { + // Delete the proxies and remove the entry + for (auto& proxy_callback_pair : writer_entry.second) + { + delete proxy_callback_pair.first; + } + } + + for (auto& reader_entry : async_get_type_reader_callbacks_) + { + // Delete the proxies and remove the entry + for (auto& proxy_callback_pair : reader_entry.second) + { + delete proxy_callback_pair.first; + } + } } bool TypeLookupManager::init(