diff options
author | Mykola Korniichuk <mkorniichuk@luxoft.com> | 2018-09-19 14:23:18 +0300 |
---|---|---|
committer | Mykola Korniichuk <mkorniichuk@luxoft.com> | 2018-09-19 14:23:18 +0300 |
commit | 4bec0f3e050e167c837576f507711232c3e7d6be (patch) | |
tree | 6997559063e14756e8af9dcd7be18ab82e00033e | |
parent | 28235f88a6733106a7e8a0d490dfb16a5f374a33 (diff) | |
download | sdl_core-fix/SDL_crash_during_cleanup_if_storage_not_initialized.tar.gz |
SDL crash during StopComponents() if StartComponents() failed.fix/SDL_crash_during_cleanup_if_storage_not_initialized
If resumption_storage_ in ResumeCtrlImpl is failed to initialize,
SDL will try to stop components and exit with error code.
At this time application manager tries to unregister all applications and
call ResumeCtrlImpl::OnIgnitionOff() where resumption_storage_ is used. As a result, a crash will occur.
As an example, if AppStorageFolder have no read/write access, resumption_storage_
fails to initialize.
-rw-r--r-- | src/components/application_manager/src/resumption/resume_ctrl_impl.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index 3e77078ee5..ce02bd33b2 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -336,6 +336,10 @@ void ResumeCtrlImpl::OnSuspend() { void ResumeCtrlImpl::OnIgnitionOff() { LOG4CXX_AUTO_TRACE(logger_); if (!application_manager_.IsLowVoltage()) { + if (!resumption_storage_) { + LOG4CXX_ERROR(logger_, "resumption_storage_ is not initialized"); + return; + } resumption_storage_->IncrementIgnOffCount(); resumption_storage_->ResetGlobalIgnOnCount(); FinalPersistData(); @@ -572,6 +576,10 @@ void ResumeCtrlImpl::SaveDataOnTimer() { void ResumeCtrlImpl::FinalPersistData() { LOG4CXX_AUTO_TRACE(logger_); + if (!resumption_storage_) { + LOG4CXX_ERROR(logger_, "resumption_storage_ is not initialized"); + return; + } StopSavePersistentDataTimer(); SaveAllApplications(); resumption_storage_->Persist(); |