rtpptdemux: plug pad leak in error code path

Based on patch by: Stig Sandnes <stig.sandnes@cisco.com>

Don't leak srcpad if there are no caps.

https://bugzilla.gnome.org/show_bug.cgi?id=667820
This commit is contained in:
Tim-Philipp Müller 2012-01-13 10:32:59 +00:00
parent ffe010ee4d
commit f10e8192fa

View file

@ -326,6 +326,10 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf)
GstPadTemplate *templ;
gchar *padname;
caps = gst_rtp_pt_demux_get_caps (rtpdemux, pt);
if (!caps)
goto no_caps;
klass = GST_ELEMENT_GET_CLASS (rtpdemux);
templ = gst_element_class_get_pad_template (klass, "src_%d");
padname = g_strdup_printf ("src_%d", pt);
@ -334,10 +338,6 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf)
g_free (padname);
gst_pad_set_event_function (srcpad, gst_rtp_pt_demux_src_event);
caps = gst_rtp_pt_demux_get_caps (rtpdemux, pt);
if (!caps)
goto no_caps;
caps = gst_caps_make_writable (caps);
gst_caps_set_simple (caps, "payload", G_TYPE_INT, pt, NULL);
gst_pad_set_caps (srcpad, caps);