[vlc-commits] direct3d11: fix leak and potential crash on region mapping errors
Steve Lhomme
git at videolan.org
Fri Apr 13 12:45:41 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Apr 13 12:31:03 2018 +0200| [d2575e5ebc63212f8fdb4e0d337fcaeabe093db6] | committer: Steve Lhomme
direct3d11: fix leak and potential crash on region mapping errors
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d2575e5ebc63212f8fdb4e0d337fcaeabe093db6
---
modules/video_output/win32/direct3d11.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 3f1163803a..acba5515be 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -3166,7 +3166,10 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
err = CommonUpdatePicture(quad_picture, NULL, mappedResource.pData, mappedResource.RowPitch);
if (err != VLC_SUCCESS) {
msg_Err(vd, "Failed to set the buffer on the SPU picture" );
+ ID3D11DeviceContext_Unmap(sys->d3d_dev.d3dcontext, ((d3d_quad_t *) quad_picture->p_sys)->picSys.resource[KNOWN_DXGI_INDEX], 0);
picture_Release(quad_picture);
+ if ((*region)[i] == quad_picture)
+ (*region)[i] = NULL;
continue;
}
@@ -3176,6 +3179,8 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
} else {
msg_Err(vd, "Failed to map the SPU texture (hr=0x%lX)", hr );
picture_Release(quad_picture);
+ if ((*region)[i] == quad_picture)
+ (*region)[i] = NULL;
continue;
}
More information about the vlc-commits
mailing list