[vlc-devel] [PATCH 1/2] direct3d11: fix use of uninitialized data when init fails

Steve Lhomme robux4 at videolabs.io
Tue Jun 21 09:57:38 CEST 2016


---
 modules/video_output/win32/direct3d11.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 37a04fb..68b1bb1 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1609,15 +1609,30 @@ error:
 static void ReleaseQuad(d3d_quad_t *quad)
 {
     if (quad->pVertexBuffer)
+    {
         ID3D11Buffer_Release(quad->pVertexBuffer);
+        quad->pVertexBuffer = NULL;
+    }
     if (quad->pTexture)
+    {
         ID3D11Texture2D_Release(quad->pTexture);
+        quad->pTexture = NULL;
+    }
     if (quad->d3dresViewY)
+    {
         ID3D11ShaderResourceView_Release(quad->d3dresViewY);
+        quad->d3dresViewY = NULL;
+    }
     if (quad->d3dresViewUV)
+    {
         ID3D11ShaderResourceView_Release(quad->d3dresViewUV);
+        quad->d3dresViewUV = NULL;
+    }
     if (quad->d3dpixelShader)
+    {
         ID3D11VertexShader_Release(quad->d3dpixelShader);
+        quad->d3dpixelShader = NULL;
+    }
 }
 
 static void Direct3D11DestroyResources(vout_display_t *vd)
-- 
2.8.2



More information about the vlc-devel mailing list