diff --git a/media_driver/agnostic/common/os/mos_graphicsresource.cpp b/media_driver/agnostic/common/os/mos_graphicsresource.cpp index 0c4e9211528..09b51236845 100644 --- a/media_driver/agnostic/common/os/mos_graphicsresource.cpp +++ b/media_driver/agnostic/common/os/mos_graphicsresource.cpp @@ -116,6 +116,7 @@ MOS_STATUS GraphicsResource::Dump(OsContext* osContextPtr, uint32_t overrideOffs if (hFile != nullptr) { MosUtilities::MosCloseHandle(hFile); + hFile = nullptr; } } diff --git a/media_driver/agnostic/common/os/mos_os_virtualengine.cpp b/media_driver/agnostic/common/os/mos_os_virtualengine.cpp index 75dbc5a73d5..b86ad5e686f 100644 --- a/media_driver/agnostic/common/os/mos_os_virtualengine.cpp +++ b/media_driver/agnostic/common/os/mos_os_virtualengine.cpp @@ -107,7 +107,7 @@ MOS_STATUS Mos_VirtualEngineInterface_Initialize( pVEInterf->veInterface = MOS_New(MosOsVeSinglePipeSpecific); } MOS_OS_CHK_NULL(pVEInterf->veInterface); - pVEInterf->veInterface->Initialize(pOsInterface->osStreamState, pVEInitParms); + MOS_OS_CHK_STATUS(pVEInterf->veInterface->Initialize(pOsInterface->osStreamState, pVEInitParms)); pOsInterface->osStreamState->virtualEngineInterface = pVEInterf->veInterface; } return eStatus; diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_renderstate.h b/media_driver/agnostic/common/vp/hal/vphal_render_renderstate.h index f0b1fb26428..bb074df8262 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_render_renderstate.h +++ b/media_driver/agnostic/common/vp/hal/vphal_render_renderstate.h @@ -93,7 +93,8 @@ class RenderpassData // free all allocated surfaces while (i > 0) { - MOS_FreeMemAndSetNull(TempOutputSurfaces[--i]); + --i; + MOS_FreeMemAndSetNull(TempOutputSurfaces[i]); } return MOS_STATUS_NO_SPACE; } diff --git a/media_softlet/agnostic/common/heap_manager/memory_block_manager.cpp b/media_softlet/agnostic/common/heap_manager/memory_block_manager.cpp index a83cf781f1b..5ec48f4fcad 100644 --- a/media_softlet/agnostic/common/heap_manager/memory_block_manager.cpp +++ b/media_softlet/agnostic/common/heap_manager/memory_block_manager.cpp @@ -240,7 +240,12 @@ MOS_STATUS MemoryBlockManager::RegisterHeap(uint32_t heapId, uint32_t size , boo auto heap = MOS_New(Heap, heapId); HEAP_CHK_NULL(heap); - HEAP_CHK_STATUS(heap->RegisterOsInterface(m_osInterface)); + eStatus = heap->RegisterOsInterface(m_osInterface); + if (MOS_FAILED(eStatus)) + { + MOS_Delete(heap); + HEAP_CHK_STATUS(eStatus); + } size = MOS_ALIGN_CEIL(size, m_heapAlignment); if (hwWriteOnly) @@ -248,7 +253,12 @@ MOS_STATUS MemoryBlockManager::RegisterHeap(uint32_t heapId, uint32_t size , boo heap->SetHeapHwWriteOnly(hwWriteOnly); } - HEAP_CHK_STATUS(heap->Allocate(size, m_lockHeapsOnAllocate)); + eStatus = heap->Allocate(size, m_lockHeapsOnAllocate); + if (MOS_FAILED(eStatus)) + { + MOS_Delete(heap); + HEAP_CHK_STATUS(eStatus); + } if (heap->IsValid()) { @@ -264,7 +274,12 @@ MOS_STATUS MemoryBlockManager::RegisterHeap(uint32_t heapId, uint32_t size , boo std::shared_ptr managedHeap = nullptr; managedHeap = MakeShared(); - HEAP_CHK_NULL(managedHeap); + if (managedHeap == nullptr) + { + MOS_Delete(heap); + MOS_Delete(adjacencyListBegin); + HEAP_CHK_STATUS(MOS_STATUS_NULL_POINTER); + } managedHeap->m_heap = heap; managedHeap->m_size = managedHeap->m_heap->GetSize(); managedHeap->m_adjacencyListBegin = adjacencyListBegin; @@ -298,7 +313,7 @@ MOS_STATUS MemoryBlockManager::UnregisterHeap(uint32_t heapId) if (heapId == (*iterator)->m_heap->GetId()) { bool blocksUpdated = false; - RefreshBlockStates(blocksUpdated); + HEAP_CHK_STATUS(RefreshBlockStates(blocksUpdated)); (*iterator)->m_heap->PrepareForFree(); m_totalSizeOfHeaps -= (*iterator)->m_heap->GetSize(); diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/sw_filter_pipe.cpp b/media_softlet/agnostic/common/vp/hal/feature_manager/sw_filter_pipe.cpp index 39e3022bc07..5804f1eb45c 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/sw_filter_pipe.cpp +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/sw_filter_pipe.cpp @@ -732,7 +732,7 @@ MOS_STATUS SwFilterPipe::AddSwFilterUnordered(SwFilter *swFilter, bool isInputPi if (nullptr == pSubPipe && !isInputPipe) { - auto& pipes = isInputPipe ? m_InputPipes : m_OutputPipes; + auto& pipes = m_OutputPipes; SwFilterSubPipe *pipe = MOS_New(SwFilterSubPipe); VP_PUBLIC_CHK_NULL_RETURN(pipe); if ((size_t)index <= pipes.size())