Commit f5d41f28 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

mfplat: Prevent use after free (Coverity).

parent 312e0d51
...@@ -976,6 +976,7 @@ static const MFVIDEOFORMAT * WINAPI video_mediatype_GetVideoFormat(IMFVideoMedia ...@@ -976,6 +976,7 @@ static const MFVIDEOFORMAT * WINAPI video_mediatype_GetVideoFormat(IMFVideoMedia
TRACE("%p.\n", iface); TRACE("%p.\n", iface);
CoTaskMemFree(media_type->video_format); CoTaskMemFree(media_type->video_format);
media_type->video_format = NULL;
if (FAILED(hr = MFCreateMFVideoFormatFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->video_format, &size))) if (FAILED(hr = MFCreateMFVideoFormatFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->video_format, &size)))
WARN("Failed to create format description, hr %#lx.\n", hr); WARN("Failed to create format description, hr %#lx.\n", hr);
...@@ -1376,6 +1377,7 @@ static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaT ...@@ -1376,6 +1377,7 @@ static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaT
TRACE("%p.\n", iface); TRACE("%p.\n", iface);
CoTaskMemFree(media_type->audio_format); CoTaskMemFree(media_type->audio_format);
media_type->audio_format = NULL;
if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->audio_format, if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->audio_format,
&size, MFWaveFormatExConvertFlag_Normal))) &size, MFWaveFormatExConvertFlag_Normal)))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment