summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatej Knopp <matej.knopp@gmail.com>2013-07-26 16:02:01 +0200
committerTim-Philipp Müller <tim@centricular.net>2013-07-30 00:06:54 +0100
commit3196c9e7554919adf36eacdf0ece8bb952253107 (patch)
tree6be5f55f3817743ab2e5cee1171d54dece390633
parent6defa94e84b7a902e000e9464170e9844973e65e (diff)
downloadgst-plugins-good-3196c9e7554919adf36eacdf0ece8bb952253107.tar.gz
gst-plugins-good-3196c9e7554919adf36eacdf0ece8bb952253107.tar.xz
matroskademux: fix memory leak in check_subtitle_buffer
https://bugzilla.gnome.org/show_bug.cgi?id=704921
-rw-r--r--gst/matroska/matroska-demux.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 94db0009b..c899fe1a3 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -3025,6 +3025,7 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
GstBuffer *newbuf;
gchar *utf8;
GstMapInfo map;
+ gboolean needs_unmap = TRUE;
sub_stream = (GstMatroskaTrackSubtitleContext *) stream;
@@ -3074,10 +3075,10 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
utf8 = g_strdup ("invalid subtitle");
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
+ gst_buffer_unmap (*buf, &map);
gst_buffer_copy_into (newbuf, *buf,
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_META,
0, -1);
- gst_buffer_unmap (*buf, &map);
gst_buffer_unref (*buf);
*buf = newbuf;
@@ -3094,16 +3095,20 @@ next:
utf8 = g_markup_escape_text ((gchar *) map.data, map.size);
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
+ gst_buffer_unmap (*buf, &map);
gst_buffer_copy_into (newbuf, *buf,
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS |
GST_BUFFER_COPY_META, 0, -1);
- gst_buffer_unmap (*buf, &map);
gst_buffer_unref (*buf);
*buf = newbuf;
+ needs_unmap = FALSE;
}
}
+ if (needs_unmap)
+ gst_buffer_unmap (*buf, &map);
+
return GST_FLOW_OK;
}