summaryrefslogtreecommitdiff
path: root/gst/mpegtsmux
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-10-25 19:31:51 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-11-03 20:35:41 +0200
commit23a9e4323aa0bb86b5b50f80d6f896ff2071d990 (patch)
treee2316e8da5f6c9d4ec70b52f3e1716155d07032b /gst/mpegtsmux
parent4e803d0bb3b1532d4577c28c9ea4875c83cbfd69 (diff)
tsmux: Don't leak buffer in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=757049
Diffstat (limited to 'gst/mpegtsmux')
-rw-r--r--gst/mpegtsmux/mpegtsmux.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index bb918bcc0..9b7abfc87 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -1117,8 +1117,11 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data,
if (G_UNLIKELY (mux->first)) {
ret = mpegtsmux_create_streams (mux);
- if (G_UNLIKELY (ret != GST_FLOW_OK))
+ if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+ if (buf)
+ gst_buffer_unref (buf);
return ret;
+ }
mpegtsmux_prepare_srcpad (mux);
@@ -1133,6 +1136,9 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data,
mpegtsmux_push_packets (mux, TRUE);
gst_pad_push_event (mux->srcpad, gst_event_new_eos ());
+ if (buf)
+ gst_buffer_unref (buf);
+
return GST_FLOW_OK;
}
@@ -1234,6 +1240,8 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data,
if (best->stream->is_meta && gst_buffer_get_size (buf) > (G_MAXUINT16 - 3)) {
GST_WARNING_OBJECT (mux, "KLV meta unit too big, splitting not supported");
+ if (buf)
+ gst_buffer_unref (buf);
return GST_FLOW_OK;
}
@@ -1273,6 +1281,8 @@ write_fail:
}
no_program:
{
+ if (buf)
+ gst_buffer_unref (buf);
GST_ELEMENT_ERROR (mux, STREAM, MUX,
("Stream on pad %" GST_PTR_FORMAT
" is not associated with any program", COLLECT_DATA_PAD (best)),