From 081fc57f709db16aa22f62c6337753069d7f36fa Mon Sep 17 00:00:00 2001 From: Wang_PengX Date: Wed, 18 Sep 2024 20:31:25 +0800 Subject: [PATCH] [Media Common] [VP][MOS] fix double free issue set nullptr after free memory. --- media_softlet/agnostic/common/os/mos_oca_rtlog_mgr.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/media_softlet/agnostic/common/os/mos_oca_rtlog_mgr.cpp b/media_softlet/agnostic/common/os/mos_oca_rtlog_mgr.cpp index 6431eb3fd8..6150a1f349 100644 --- a/media_softlet/agnostic/common/os/mos_oca_rtlog_mgr.cpp +++ b/media_softlet/agnostic/common/os/mos_oca_rtlog_mgr.cpp @@ -124,13 +124,17 @@ void MosOcaRTLogMgr::UnregisterRes(OsContextNext *osDriverContext) if (!resInterface.osInterface || !resInterface.osInterface->pfnFreeResource) { MOS_SafeFreeMemory(resInterface.ocaRTLogResource); + resInterface.ocaRTLogResource = nullptr; MOS_SafeFreeMemory(resInterface.osInterface); + resInterface.osInterface = nullptr; return; } resInterface.osInterface->pfnFreeResource(resInterface.osInterface, resInterface.ocaRTLogResource); MOS_SafeFreeMemory(resInterface.ocaRTLogResource); + resInterface.ocaRTLogResource = nullptr; Mos_DestroyInterface(resInterface.osInterface); MOS_SafeFreeMemory(resInterface.osInterface); + resInterface.osInterface = nullptr; } MosOcaRTLogMgr::MosOcaRTLogMgr()