From 0276663d0cca2628ac5dcaf339625a21097350fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 14 Mar 2011 12:39:23 +0000 Subject: [PATCH] mpegtsmux: fix broken pad caps refcount handling gst_caps_make_writable() takes ownership of the caps passed in, but the caller doesn't own a ref to the caps here, because GST_PAD_CAPS doesn't return a ref. Looks like the code relied on a caps leak elsewhere for this to work properly. --- gst/mpegtsmux/mpegtsmux.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index a3c8bb3e01..9328f9cfe0 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -946,10 +946,10 @@ mpegtsdemux_set_header_on_caps (MpegTsMux * mux) GstStructure *structure; GValue array = { 0 }; GValue value = { 0 }; - GstCaps *caps = GST_PAD_CAPS (mux->srcpad); + GstCaps *caps; GList *sh; - caps = gst_caps_make_writable (caps); + caps = gst_caps_copy (GST_PAD_CAPS (mux->srcpad)); structure = gst_caps_get_structure (caps, 0); g_value_init (&array, GST_TYPE_ARRAY); @@ -987,6 +987,7 @@ mpegtsdemux_prepare_srcpad (MpegTsMux * mux) /* Set caps on src pad from our template and push new segment */ gst_pad_set_caps (mux->srcpad, caps); + gst_caps_unref (caps); if (!gst_pad_push_event (mux->srcpad, new_seg)) { GST_WARNING_OBJECT (mux, "New segment event was not handled downstream");