diff --git a/media_driver/agnostic/common/cm/cm_device_rt_base.h b/media_driver/agnostic/common/cm/cm_device_rt_base.h index c9c5fec8b3a..a81306b392e 100644 --- a/media_driver/agnostic/common/cm/cm_device_rt_base.h +++ b/media_driver/agnostic/common/cm/cm_device_rt_base.h @@ -476,7 +476,13 @@ class CmDeviceRTBase: public CmDevice CmDeviceRTBase(uint32_t DevCreateOption); - ~CmDeviceRTBase() {}; + ~CmDeviceRTBase() + { + if (m_notifierGroup != nullptr) + { + delete m_notifierGroup; + } + } void DestructCommon(); diff --git a/media_driver/agnostic/common/cm/cm_execution_adv.cpp b/media_driver/agnostic/common/cm/cm_execution_adv.cpp index 764c674eb4f..f917a16aa34 100644 --- a/media_driver/agnostic/common/cm/cm_execution_adv.cpp +++ b/media_driver/agnostic/common/cm/cm_execution_adv.cpp @@ -780,11 +780,17 @@ int CmExecutionAdv::SubmitGpgpuTask(CMRT_UMD::CmQueueRT *queue, cmdBuf->AddSipState(cmish->GetSipKernelOffset()); - CM_CHK_MOSSTATUS_RETURN(m_cmhal->osInterface->pfnRegisterResource( + MOS_STATUS eStatus = m_cmhal->osInterface->pfnRegisterResource( m_cmhal->osInterface, &m_cmhal->csrResource, true, - true)); + true); + + if (eStatus != MOS_STATUS_SUCCESS) + { + cmdsh->DestroyMediaState(cmMediaState); + return eStatus; + } cmdBuf->AddCsrBaseAddress(&m_cmhal->csrResource); diff --git a/media_driver/agnostic/common/cm/cm_hal.cpp b/media_driver/agnostic/common/cm/cm_hal.cpp index abee00ee9f3..1226e9e3a29 100644 --- a/media_driver/agnostic/common/cm/cm_hal.cpp +++ b/media_driver/agnostic/common/cm/cm_hal.cpp @@ -10545,6 +10545,8 @@ MOS_STATUS HalCm_Create( else { CM_ASSERTMESSAGE("Allocate MhwInterfaces failed"); + HalCm_Destroy(state); + *cmState = nullptr; return MOS_STATUS_NO_SPACE; } }