summaryrefslogtreecommitdiff
authorStefan Kost <ensonic@users.sf.net>2009-03-31 14:06:50 (GMT)
committer Stefan Kost <ensonic@users.sf.net>2009-03-31 14:06:50 (GMT)
commit5ac6b84475657f7e76bb092273e6daed0c26d0dd (patch) (side-by-side diff)
treebdece19ea60dca1be4e765ed859973303910155b
parentfa8e2d9bfeec654f036995861aabb9b9907fb8e3 (diff)
downloadgst-plugins-good-5ac6b84475657f7e76bb092273e6daed0c26d0dd.zip
gst-plugins-good-5ac6b84475657f7e76bb092273e6daed0c26d0dd.tar.gz
matroska: don't alter passed data and especialy don't leak.
If we need different size, Make a copy, work with that and free it.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gst/matroska/matroska-demux.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 118a3d6..6b9c377 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -4981,9 +4981,8 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
return NULL;
}
if (size < sizeof (gst_riff_strf_vids)) {
- vids =
- (gst_riff_strf_vids *) g_realloc (vids,
- sizeof (gst_riff_strf_vids));
+ vids = g_new (gst_riff_strf_vids, 1);
+ memcpy (vids, data, size);
}
/* little-endian -> byte-order */
@@ -5011,6 +5010,9 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
if (buf)
gst_buffer_unref (buf);
+
+ if (vids != (gst_riff_strf_vids *) data)
+ g_free (vids);
}
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
guint32 fourcc = 0;