summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2017-09-14 14:08:14 +0300
committerAKalinich-Luxoft <AKalinich@luxoft.com>2017-09-18 18:59:38 +0300
commit6b882d404bf081fc01d5fcb548119d05213091e5 (patch)
treeaab179e3bfe4f0aac3f986759ca6712fafe13ff2
parent8455aab11dd3e1f6e9828be4c6cd3a62cad9870a (diff)
downloadsdl_core-6b882d404bf081fc01d5fcb548119d05213091e5.tar.gz
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.
-rw-r--r--src/components/remote_control/src/resource_allocation_manager_impl.cc8
1 files 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;