[vlc-commits] d3d11: fix double resource allocation

Steve Lhomme git at videolan.org
Fri Jun 26 12:25:54 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jun 26 12:25:18 2020 +0200| [cf3eee8f9a13a9f126a0ae8501067b856cb90e15] | committer: Steve Lhomme

d3d11: fix double resource allocation

The D3D11_AllocateResourceView() is already done in D3D11_AllocPicture().

Fixes a leak when D3D11 filters are used.

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

 modules/hw/d3d11/d3d11_deinterlace.c | 9 +--------
 modules/hw/d3d11/d3d11_filters.c     | 9 +--------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 3ad3224daa..fa1684d5ed 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -226,14 +226,7 @@ picture_t *AllocPicture( filter_t *p_filter )
     if (unlikely(cfg == NULL))
         return NULL;
 
-    picture_t *pic = D3D11_AllocPicture(VLC_OBJECT(p_filter), &p_filter->fmt_out.video, p_filter->vctx_out, cfg);
-    if (unlikely(pic == NULL))
-        return NULL;
-
-    struct d3d11_pic_context *pic_ctx = container_of(pic->context, struct d3d11_pic_context, s);
-    D3D11_AllocateResourceView(p_filter, p_sys->d3d_dev->d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc);
-
-    return pic;
+    return D3D11_AllocPicture(VLC_OBJECT(p_filter), &p_filter->fmt_out.video, p_filter->vctx_out, cfg);
 }
 
 int D3D11OpenDeinterlace(vlc_object_t *obj)
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index c38dcb2316..64325e4508 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -209,14 +209,7 @@ static picture_t *AllocPicture( filter_t *p_filter )
     if (unlikely(cfg == NULL))
         return NULL;
 
-    picture_t *pic = D3D11_AllocPicture(VLC_OBJECT(p_filter), &p_filter->fmt_out.video, p_filter->vctx_out, cfg);
-    if (unlikely(pic == NULL))
-        return NULL;
-
-    struct d3d11_pic_context *pic_ctx = container_of(pic->context, struct d3d11_pic_context, s);
-    D3D11_AllocateResourceView(p_filter, p_sys->d3d_dev->d3ddevice, cfg, pic_ctx->picsys.texture, 0, pic_ctx->picsys.renderSrc);
-
-    return pic;
+    return D3D11_AllocPicture(VLC_OBJECT(p_filter), &p_filter->fmt_out.video, p_filter->vctx_out, cfg);
 }
 
 static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)



More information about the vlc-commits mailing list