[vlc-devel] [PATCH] direct3d11: fix crashes when releasing resources on errors

Steve Lhomme robux4 at videolabs.io
Tue Mar 28 10:21:33 CEST 2017


---
 modules/video_output/win32/direct3d11.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 510e9b0352..f8f5b3710b 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -643,11 +643,10 @@ static int AllocateShaderView(vout_display_t *vd, const d3d_format_t *format,
 
     if (i != D3D11_MAX_SHADER_VIEW)
     {
-        while (i >= 0)
+        while (--i >= 0)
         {
             ID3D11ShaderResourceView_Release(picsys->resourceView[i]);
             picsys->resourceView[i] = NULL;
-            i--;
         }
         return VLC_EGENERIC;
     }
@@ -2758,7 +2757,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
 
         picture_t *quad_picture = (*region)[i];
         if (quad_picture == NULL) {
-            ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW];
+            ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {0};
             d3d_quad_t *d3dquad = calloc(1, sizeof(*d3dquad));
             if (unlikely(d3dquad==NULL)) {
                 continue;
-- 
2.11.1



More information about the vlc-devel mailing list