From: Hwankyu Jhun Date: Wed, 8 Jun 2022 07:33:22 +0000 (+0900) Subject: Fix memory leak X-Git-Tag: accepted/tizen/unified/20220610.134735~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0905bb297b09b9929befd4bcf6d984eab2ed9845;p=platform%2Fcore%2Fappfw%2Frpc-port.git Fix memory leak When the handle is destroying, the session information of the DebugPort has to be removed. Change-Id: I6c931b889261d4d5374ac89775c2b50a1c6ad483 Signed-off-by: Hwankyu Jhun --- diff --git a/src/proxy-internal.cc b/src/proxy-internal.cc index faaa062..2eb538b 100644 --- a/src/proxy-internal.cc +++ b/src/proxy-internal.cc @@ -105,6 +105,9 @@ Proxy::Proxy() { Proxy::~Proxy() { std::lock_guard lock(GetMutex()); _D("Proxy::~Proxy()"); + if (main_port_.get() != nullptr) + DebugPort::GetInst()->RemoveSession(main_port_->GetFd()); + listener_ = nullptr; UnsetIdler(); UnsetConnTimer(); diff --git a/src/stub-internal.cc b/src/stub-internal.cc index f16035c..1ffc2e8 100644 --- a/src/stub-internal.cc +++ b/src/stub-internal.cc @@ -95,6 +95,11 @@ Stub::Stub(std::string port_name) : port_name_(std::move(port_name)) { Stub::~Stub() { std::lock_guard lock(GetMutex()); _D("Stub::~Stub"); + for (auto& p : ports_) { + if (!p->IsDelegate()) + DebugPort::GetInst()->RemoveSession(p->GetFd()); + } + listener_ = nullptr; server_.reset(); }