mfplat: Prevent use after free (Coverity).

Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Fabian Maurer 2022-04-26 21:03:22 +02:00 committed by Alexandre Julliard
parent 312e0d518f
commit f5d41f28f6
1 changed files with 2 additions and 0 deletions

View File

@ -976,6 +976,7 @@ static const MFVIDEOFORMAT * WINAPI video_mediatype_GetVideoFormat(IMFVideoMedia
TRACE("%p.\n", iface);
CoTaskMemFree(media_type->video_format);
media_type->video_format = NULL;
if (FAILED(hr = MFCreateMFVideoFormatFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->video_format, &size)))
WARN("Failed to create format description, hr %#lx.\n", hr);
@ -1376,6 +1377,7 @@ static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaT
TRACE("%p.\n", iface);
CoTaskMemFree(media_type->audio_format);
media_type->audio_format = NULL;
if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->audio_format,
&size, MFWaveFormatExConvertFlag_Normal)))
{