From 5c50c69316aebed05089131421894b87dd62f78b Mon Sep 17 00:00:00 2001 From: Andrei Aristarkhov Date: Wed, 28 Aug 2024 23:02:35 -0700 Subject: [PATCH] SctpTransport::Instances was not being freed causing memory leak warnings --- src/impl/sctptransport.cpp | 2 +- src/impl/sctptransport.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/impl/sctptransport.cpp b/src/impl/sctptransport.cpp index 0946d2542..6afe77214 100644 --- a/src/impl/sctptransport.cpp +++ b/src/impl/sctptransport.cpp @@ -82,7 +82,7 @@ class SctpTransport::InstancesSet { std::shared_mutex mMutex; }; -SctpTransport::InstancesSet *SctpTransport::Instances = new InstancesSet; +std::unique_ptr SctpTransport::Instances = std::make_unique(); void SctpTransport::Init() { usrsctp_init(0, SctpTransport::WriteCallback, SctpTransport::DebugCallback); diff --git a/src/impl/sctptransport.hpp b/src/impl/sctptransport.hpp index 82b02a70c..4e1a9a02e 100644 --- a/src/impl/sctptransport.hpp +++ b/src/impl/sctptransport.hpp @@ -127,7 +127,7 @@ class SctpTransport final : public Transport, public std::enable_shared_from_thi static void DebugCallback(const char *format, ...); class InstancesSet; - static InstancesSet *Instances; + static std::unique_ptr Instances; }; } // namespace rtc::impl