Fabian Maurer : mfplat: Prevent use after free (Coverity).

Alexandre Julliard julliard at winehq.org
Wed Apr 27 16:12:12 CDT 2022


Module: wine
Branch: master
Commit: f5d41f28f6442bd7e074efa17785b40ad3c65ba4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f5d41f28f6442bd7e074efa17785b40ad3c65ba4

Author: Fabian Maurer <dark.shadow4 at web.de>
Date:   Tue Apr 26 21:03:22 2022 +0200

mfplat: Prevent use after free (Coverity).

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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)))
     {




More information about the wine-cvs mailing list