From 6b882d404bf081fc01d5fcb548119d05213091e5 Mon Sep 17 00:00:00 2001 From: AKalinich-Luxoft Date: Thu, 14 Sep 2017 14:08:14 +0300 Subject: Fix possible NULL pointer assignment in Resource Allocation Manager One of the reasons of this defect is that shared_ptr was initied with NULL pointer so it causes DCHECK fatal error. ResourceAllocationManagerImpl::GetApplicationExtention() returns NULL pointer in some cases what is not correct. It was replaced with default constructed shared pointers. --- .../remote_control/src/resource_allocation_manager_impl.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/remote_control/src/resource_allocation_manager_impl.cc b/src/components/remote_control/src/resource_allocation_manager_impl.cc index ecb07bb349..233cc79764 100644 --- a/src/components/remote_control/src/resource_allocation_manager_impl.cc +++ b/src/components/remote_control/src/resource_allocation_manager_impl.cc @@ -162,15 +162,16 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() { RCAppExtensionPtr ResourceAllocationManagerImpl::GetApplicationExtention( application_manager::ApplicationSharedPtr application) { LOG4CXX_AUTO_TRACE(logger_); + + RCAppExtensionPtr rc_app_extension; if (!application) { - return NULL; + return rc_app_extension; } - RCAppExtensionPtr rc_app_extension; application_manager::AppExtensionPtr app_extension = application->QueryInterface(rc_plugin_.GetModuleID()); if (!app_extension) { - return NULL; + return rc_app_extension; } rc_app_extension = @@ -181,6 +182,7 @@ RCAppExtensionPtr ResourceAllocationManagerImpl::GetApplicationExtention( } void ResourceAllocationManagerImpl::RemoveAppsSubscriptions(const Apps& apps) { + LOG4CXX_AUTO_TRACE(logger_); Apps::const_iterator app = apps.begin(); for (; apps.end() != app; ++app) { application_manager::ApplicationSharedPtr app_ptr = *app; -- cgit v1.2.1