From: Hwankyu Jhun Date: Sun, 30 Jun 2024 23:49:20 +0000 (+0900) Subject: Fix static analysis issues X-Git-Tag: accepted/tizen/unified/20240702.162331~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e27e8fa36a92aefbbd0f30b6199d355fa694799;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Fix static analysis issues Checker: - MEMORY_LEAK Change-Id: I6c3bf1f4947b780caab325f08cfcb4e28699ab60 Signed-off-by: Hwankyu Jhun --- diff --git a/component_based/app_control/component_based_app_control.cc b/component_based/app_control/component_based_app_control.cc index 470e052..4b6a186 100644 --- a/component_based/app_control/component_based_app_control.cc +++ b/component_based/app_control/component_based_app_control.cc @@ -154,6 +154,11 @@ AppControl::AppControl(const AppControl& control) { AppControl& AppControl::operator=(const AppControl& control) { if (this != &control) { + if (impl_->handle_) { + app_control_destroy(impl_->handle_); + impl_->handle_ = nullptr; + } + app_control_h handle = nullptr; if (app_control_clone(&handle, control.impl_->handle_) != APP_CONTROL_ERROR_NONE) { @@ -171,8 +176,12 @@ AppControl::AppControl(AppControl&& control) { AppControl& AppControl::operator=(AppControl&& control) { if (this != &control) { + if (impl_->handle_) + app_control_destroy(impl_->handle_); + impl_->handle_ = control.impl_->handle_; control.impl_->handle_ = nullptr; + app_control_create(&control.impl_->handle_); } return *this; }