[vlc-commits] [Git][videolan/vlc][master] 3 commits: d3d11: fix dec_device reference leak in D3D11OpenCPUConverter

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Apr 16 13:44:24 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
58e5e481 by Martin Finkel at 2026-04-16T11:53:49+00:00
d3d11: fix dec_device reference leak in D3D11OpenCPUConverter

D3D11CreateVideoContext internally holds the decoder device via
vlc_decoder_device_Hold, but the original reference obtained by
filter_HoldDecoderDeviceType was never released, leaking one
reference on every successful call.

- - - - -
e038d6c9 by Martin Finkel at 2026-04-16T11:53:49+00:00
d3d11: fix p_sys leak in D3D11OpenBlockDecoder

When D3D11CreateVideoContext or decoder_UpdateVideoOutput failed,
dec_dev and vctx were manually released but p_sys was never deleted.
Use delete p_sys which lets the destructor handle releasing both.

- - - - -
1fafbeec by Martin Finkel at 2026-04-16T11:53:49+00:00
d3d11: fix per-plane texture leak in AllocateTextures

When CreateTexture2D failed for plane N > 0 in the non-sliced path,
the error label did not release textures already created for planes
0..N-1. Initialize plane to 0 and release textures[0..plane-1] on
error.

- - - - -


3 changed files:

- modules/hw/d3d11/d3d11_decoder.cpp
- modules/hw/d3d11/d3d11_surface.c
- modules/video_chroma/d3d11_fmt.cpp


Changes:

=====================================
modules/hw/d3d11/d3d11_decoder.cpp
=====================================
@@ -280,14 +280,13 @@ int D3D11OpenBlockDecoder( vlc_object_t *obj )
             D3D11CreateVideoContext(p_sys->dec_dev, p_sys->output_format->formatTexture, p_sys->output_format->alphaTexture);
         if (!p_sys->vctx)
         {
-            vlc_decoder_device_Release(dec_dev);
+            delete p_sys;
             return VLC_EGENERIC;
         }
 
         if( decoder_UpdateVideoOutput( p_dec, p_sys->vctx ) )
         {
-            vlc_video_context_Release(p_sys->vctx);
-            vlc_decoder_device_Release(dec_dev);
+            delete p_sys;
             return VLC_EGENERIC;
         }
     }


=====================================
modules/hw/d3d11/d3d11_surface.c
=====================================
@@ -818,6 +818,7 @@ int D3D11OpenCPUConverter( filter_t *p_filter )
         vlc_assert_unreachable();
     }
     p_filter->vctx_out = D3D11CreateVideoContext(dec_device, vctx_fmt, DXGI_FORMAT_UNKNOWN);
+    vlc_decoder_device_Release(dec_device);
     if ( p_filter->vctx_out == NULL )
     {
         msg_Dbg(p_filter, "no video context");


=====================================
modules/video_chroma/d3d11_fmt.cpp
=====================================
@@ -867,7 +867,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
                       plane_t out_planes[] )
 {
     plane_t planes[PICTURE_PLANE_MAX];
-    unsigned plane, plane_count;
+    unsigned plane = 0, plane_count;
     HRESULT hr;
     ID3D11Texture2D *slicedTexture = NULL;
     D3D11_TEXTURE2D_DESC texDesc;
@@ -963,6 +963,8 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
 error:
     if (slicedTexture)
         slicedTexture->Release();
+    for (unsigned j = 0; j < plane; j++)
+        textures[j]->Release();
     return VLC_EGENERIC;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/159c9ccf80f264b8b1a813e17e5c397a988bb6a4...1fafbeec8356c42b998d25254dc02ac7f6a877d4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/159c9ccf80f264b8b1a813e17e5c397a988bb6a4...1fafbeec8356c42b998d25254dc02ac7f6a877d4
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list