소스 검색

obs-qsv11: Don't try to free non allocated array on destruction

Colin Edwards 6 년 전
부모
커밋
d8f254550f
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      plugins/obs-qsv11/QSV_Encoder_Internal.cpp

+ 6 - 4
plugins/obs-qsv11/QSV_Encoder_Internal.cpp

@@ -584,11 +584,13 @@ mfxStatus QSV_Encoder_Internal::ClearData()
 	if (m_bUseD3D11 || m_bD3D9HACK)
 		m_mfxAllocator.Free(m_mfxAllocator.pthis, &m_mfxResponse);
 
-	for (int i = 0; i < m_nSurfNum; i++) {
-		if (!m_bUseD3D11 && !m_bD3D9HACK)
-			delete m_pmfxSurfaces[i]->Data.Y;
+	if (m_pmfxSurfaces) {
+		for (int i = 0; i < m_nSurfNum; i++) {
+			if (!m_bUseD3D11 && !m_bD3D9HACK)
+				delete m_pmfxSurfaces[i]->Data.Y;
 
-		delete m_pmfxSurfaces[i];
+			delete m_pmfxSurfaces[i];
+		}
 	}
 	MSDK_SAFE_DELETE_ARRAY(m_pmfxSurfaces);