[vlc-commits] [Git][videolan/vlc][3.0.x] d3d11: fix per-plane texture leak in AllocateTextures
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri May 8 06:12:14 UTC 2026
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
34d5a2fa by Martin Finkel at 2026-05-08T05:55:08+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 only released slicedTexture. All textures already
created for prior pictures (full pool slots) and for the current
picture's first N planes were leaked.
Initialize plane and picture_count to 0 and release the previously
allocated entries on error.
Backport of master commit 1fafbeec8356c42b998d25254dc02ac7f6a877d4
adapted to 3.0.x where AllocateTextures handles a pool of pictures.
- - - - -
1 changed file:
- modules/video_chroma/d3d11_fmt.c
Changes:
=====================================
modules/video_chroma/d3d11_fmt.c
=====================================
@@ -604,7 +604,8 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
unsigned pool_size, ID3D11Texture2D *textures[] )
{
plane_t planes[PICTURE_PLANE_MAX];
- int plane, plane_count;
+ int plane = 0, plane_count;
+ unsigned picture_count = 0;
HRESULT hr;
ID3D11Texture2D *slicedTexture = NULL;
D3D11_TEXTURE2D_DESC texDesc;
@@ -666,7 +667,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
}
}
- for (unsigned picture_count = 0; picture_count < pool_size; picture_count++) {
+ for (picture_count = 0; picture_count < pool_size; picture_count++) {
for (plane = 0; plane < plane_count; plane++)
{
if (slicedTexture) {
@@ -699,6 +700,19 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
error:
if (slicedTexture)
ID3D11Texture2D_Release(slicedTexture);
+ for (unsigned p = 0; p < picture_count; p++)
+ for (unsigned i = 0; i < D3D11_MAX_SHADER_VIEW; i++)
+ if (textures[p * D3D11_MAX_SHADER_VIEW + i])
+ {
+ ID3D11Texture2D_Release(textures[p * D3D11_MAX_SHADER_VIEW + i]);
+ textures[p * D3D11_MAX_SHADER_VIEW + i] = NULL;
+ }
+ for (int i = 0; i < plane; i++)
+ if (textures[picture_count * D3D11_MAX_SHADER_VIEW + i])
+ {
+ ID3D11Texture2D_Release(textures[picture_count * D3D11_MAX_SHADER_VIEW + i]);
+ textures[picture_count * D3D11_MAX_SHADER_VIEW + i] = NULL;
+ }
return VLC_EGENERIC;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/34d5a2fa2c62e539d645d79c79ca139cf38b5980
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/34d5a2fa2c62e539d645d79c79ca139cf38b5980
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list