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

Pierre Lamot git at videolan.org
Fri Nov 24 08:49:45 CET 2017


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Nov 23 15:24:11 2017 +0100| [fe367b762364e7935f7cc541370234e712e6a129] | committer: Jean-Baptiste Kempf

dxva2: fix crash if dxva2.dll is not present (winXP)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe367b762364e7935f7cc541370234e712e6a129
---

 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;
     }
 



More information about the vlc-commits mailing list