[PATCH] winegstreamer: Fix memory leak in amt_from_gst_caps_video.
Alex Henrie
alexhenrie24 at gmail.com
Tue Nov 15 00:43:21 CST 2016
Cc: Andrew Eikum <aeikum at codeweavers.com>
Coverity #713781, "Variable vih going out of scope leaks the storage it
points to."
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/winegstreamer/gstdemux.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index a6a41ab..5d97510 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -179,18 +179,21 @@ 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;
if (!gst_video_info_from_caps (&vinfo, caps))
return FALSE;
width = vinfo.width;
height = vinfo.height;
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);
--
2.10.2
More information about the wine-patches
mailing list