[vlc-devel] [PATCH] dxva2: fix crash if dxva2.dll is not present (winXP)

Pierre Lamot pierre at videolabs.io
Thu Nov 23 15:24:11 CET 2017


---
 modules/codec/avcodec/dxva2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index f6ecc020e7..197116a1bd 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -239,6 +239,8 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
 static void Close(vlc_va_t *va, void **ctx)
 {
     vlc_va_sys_t *sys = va->sys;
+    if ( sys == NULL )
+        return;
 
     (void) ctx;
 
@@ -269,6 +271,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     /* Load dll*/
     if (D3D9_Create(va, &sys->hd3d) != VLC_SUCCESS) {
         msg_Warn(va, "cannot load d3d9.dll");
+        free( sys );
         goto error;
     }
 
@@ -276,6 +279,8 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     sys->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
     if (!sys->dxva2_dll) {
         msg_Warn(va, "cannot load DXVA2 decoder DLL");
+        D3D9_Destroy( &sys->hd3d );
+        free( sys );
         goto error;
     }
 
-- 
2.14.1



More information about the vlc-devel mailing list