From 4eb58312d6056a21c54b0cb987439c63c796bf9e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 19 Jun 2020 19:50:16 -0500 Subject: [PATCH] quartz/vmr9: Avoid leaking the surface array on connection failure. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/vmr9.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index d4331d321df..3636d47702c 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -428,11 +428,14 @@ static HRESULT allocate_surfaces(struct quartz_vmr *filter, const AM_MEDIA_TYPE case 32: info.Format = D3DFMT_X8R8G8B8; break; default: FIXME("Unhandled bit depth %u.\n", filter->bmiheader.biBitCount); + free(filter->surfaces); return E_INVALIDARG; } info.dwFlags = VMR9AllocFlag_TextureSurface; - return initialize_device(filter, &info, count); + if (FAILED(hr = initialize_device(filter, &info, count))) + free(filter->surfaces); + return hr; } for (i = 0; i < ARRAY_SIZE(formats); ++i) @@ -457,6 +460,7 @@ static HRESULT allocate_surfaces(struct quartz_vmr *filter, const AM_MEDIA_TYPE } } + free(filter->surfaces); return hr; }