[PATCH v2 5/5] mfplat: Prevent use after free (Coverity)

Fabian Maurer dark.shadow4 at web.de
Tue Apr 26 14:03:22 CDT 2022


Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/mfplat/mediatype.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c
index 71d55e2d232..b36a44d1e1c 100644
--- a/dlls/mfplat/mediatype.c
+++ b/dlls/mfplat/mediatype.c
@@ -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)))
     {
--
2.36.0




More information about the wine-devel mailing list