Alex Henrie : winegstreamer: Fix memory leaks in amt_from_gst_caps_video.
Alexandre Julliard
julliard at winehq.org
Wed Nov 16 17:39:18 CST 2016
Module: wine
Branch: master
Commit: 8d4c7245939136f8a151fab5985957d37caaba45
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8d4c7245939136f8a151fab5985957d37caaba45
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Tue Nov 15 22:41:49 2016 -0700
winegstreamer: Fix memory leaks in amt_from_gst_caps_video.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winegstreamer/gstdemux.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index a6a41ab..892385f 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -179,8 +179,8 @@ static gboolean amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt)
static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt)
{
- VIDEOINFOHEADER *vih = CoTaskMemAlloc(sizeof(*vih));
- BITMAPINFOHEADER *bih = &vih->bmiHeader;
+ VIDEOINFOHEADER *vih;
+ BITMAPINFOHEADER *bih;
gint32 width = 0, height = 0, nom = 0, denom = 0;
GstVideoInfo vinfo;
@@ -191,6 +191,9 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt)
nom = vinfo.fps_n;
denom = vinfo.fps_d;
+ vih = CoTaskMemAlloc(sizeof(*vih));
+ bih = &vih->bmiHeader;
+
amt->formattype = FORMAT_VideoInfo;
amt->pbFormat = (BYTE*)vih;
amt->cbFormat = sizeof(*vih);
@@ -207,13 +210,16 @@ static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt)
case 32: amt->subtype = MEDIASUBTYPE_RGB32; break;
default:
FIXME("Unknown bpp %u\n", bih->biBitCount);
+ CoTaskMemFree(vih);
return FALSE;
}
bih->biCompression = BI_RGB;
} else {
amt->subtype = MEDIATYPE_Video;
- if (!(amt->subtype.Data1 = gst_video_format_to_fourcc(vinfo.finfo->format)))
+ if (!(amt->subtype.Data1 = gst_video_format_to_fourcc(vinfo.finfo->format))) {
+ CoTaskMemFree(vih);
return FALSE;
+ }
switch (amt->subtype.Data1) {
case mmioFOURCC('I','4','2','0'):
case mmioFOURCC('Y','V','1','2'):
@@ -269,7 +275,8 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps)
return FALSE;
}
ret = amt_from_gst_caps_video(caps, &amt);
- FreeMediaType(&amt);
+ if (ret)
+ FreeMediaType(&amt);
TRACE("-%i\n", ret);
return ret;
} else {
More information about the wine-cvs
mailing list