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

Steve Lhomme git at videolan.org
Thu Apr 13 16:47:24 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Mar 28 10:21:33 2017 +0200| [d80e615fcc4bb44c06fff3655b8be0dbe342525b] | committer: Jean-Baptiste Kempf

direct3d11: fix crashes when releasing resources on errors

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

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

 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 d84b251871..c5762f9c0b 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;
     }
@@ -2787,7 +2786,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;



More information about the vlc-commits mailing list