From e58ca605b6ba89d6698e28a4a6a8003e8d45bfc3 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 29 Mar 2021 11:41:12 +0200 Subject: [PATCH] Delete the readers and writers (which closes them automatically) to prevent memory leaks. --- simgear/io/SGDataDistributionService.cxx | 4 ++-- simgear/io/SGDataDistributionService.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/simgear/io/SGDataDistributionService.cxx b/simgear/io/SGDataDistributionService.cxx index 85b6ce7d..c0af7f65 100644 --- a/simgear/io/SGDataDistributionService.cxx +++ b/simgear/io/SGDataDistributionService.cxx @@ -274,10 +274,10 @@ bool SG_DDS::close() { for (auto it : readers) - it->close(); + delete it; for (auto it : writers) - it->close(); + delete it; readers.clear(); writers.clear(); diff --git a/simgear/io/SGDataDistributionService.hxx b/simgear/io/SGDataDistributionService.hxx index a2d9fc72..7e38471d 100644 --- a/simgear/io/SGDataDistributionService.hxx +++ b/simgear/io/SGDataDistributionService.hxx @@ -67,7 +67,7 @@ public: } /** Destructor */ - ~SG_DDS_Topic(); + virtual ~SG_DDS_Topic(); // Set the paramaters which weren't available at creation time and use // a custom topic name.