[PATCH 0/1] MR948: winegstreamer: Fix memory leak in get_available_media_type (Coverity).
From: Alex Henrie <alexhenrie24(a)gmail.com> --- dlls/winegstreamer/resampler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index a9c9ae32e8a..cc43c033d42 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -275,7 +275,10 @@ static HRESULT get_available_media_type(DWORD index, IMFMediaType **type, BOOL o *type = NULL; if (index >= (output ? 2 : 1) * ARRAY_SIZE(audio_formats)) - return MF_E_NO_MORE_TYPES; + { + hr = MF_E_NO_MORE_TYPES; + goto done; + } subtype = audio_formats[index % ARRAY_SIZE(audio_formats)]; if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio))) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/948
Rémi Bernon (@rbernon) commented about dlls/winegstreamer/resampler.c:
*type = NULL;
if (index >= (output ? 2 : 1) * ARRAY_SIZE(audio_formats)) - return MF_E_NO_MORE_TYPES; + { + hr = MF_E_NO_MORE_TYPES; + goto done; + } subtype = audio_formats[index % ARRAY_SIZE(audio_formats)];
Probably better to move that `MFCreateMediaType` down after the subtype is checked. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/948#note_9526
On Wed Sep 28 09:38:07 2022 +0000, Rémi Bernon wrote:
Probably better to move that `MFCreateMediaType` down after the subtype is checked. That sounds fine. Should `*type = NULL;` stay above the subtype check?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/948#note_9566
On Wed Sep 28 15:46:36 2022 +0000, Alex Henrie wrote:
That sounds fine. Should `*type = NULL;` stay above the subtype check? Yes.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/948#note_9568
participants (3)
-
Alex Henrie -
Alex Henrie (@alexhenrie) -
Rémi Bernon