Browse Source

obs-qsv11: Fix memory leaks

Closes obsproject/obs-studio#3298
Shlee 5 years ago
parent
commit
dc4de4db11

+ 1 - 1
plugins/obs-qsv11/QSV_Encoder_Internal.cpp

@@ -712,7 +712,7 @@ mfxStatus QSV_Encoder_Internal::ClearData()
 	}
 
 	if (m_outBitstream.Data) {
-		delete m_outBitstream.Data;
+		delete[] m_outBitstream.Data;
 		m_outBitstream.Data = NULL;
 	}
 

+ 3 - 0
plugins/obs-qsv11/common_directx9.cpp

@@ -393,6 +393,7 @@ mfxStatus _dx9_simple_alloc(mfxFrameAllocRequest *request,
 			if (FAILED(hr)) {
 				_dx9_simple_free(response);
 				MSDK_SAFE_FREE(dxMids);
+				MSDK_SAFE_FREE(dxMidPtrs);
 				return MFX_ERR_MEMORY_ALLOC;
 			}
 			dxMidPtrs[i] = &dxMids[i];
@@ -402,6 +403,7 @@ mfxStatus _dx9_simple_alloc(mfxFrameAllocRequest *request,
 			new IDirect3DSurface9 *[request->NumFrameSuggested]);
 		if (!dxSrf.get()) {
 			MSDK_SAFE_FREE(dxMids);
+			MSDK_SAFE_FREE(dxMidPtrs);
 			return MFX_ERR_MEMORY_ALLOC;
 		}
 		hr = videoService->CreateSurface(
@@ -410,6 +412,7 @@ mfxStatus _dx9_simple_alloc(mfxFrameAllocRequest *request,
 			m_surfaceUsage, target, dxSrf.get(), NULL);
 		if (FAILED(hr)) {
 			MSDK_SAFE_FREE(dxMids);
+			MSDK_SAFE_FREE(dxMidPtrs);
 			return MFX_ERR_MEMORY_ALLOC;
 		}