[0.10] gst-plugins-good: rtpptdemux: plug pad leak in error code path

Tim Müller tpm at kemper.freedesktop.org
Wed Jan 18 03:55:42 PST 2012


Module: gst-plugins-good
Branch: 0.10
Commit: ca7251bbe35625fa2fec543177abe5a41103a1fe
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=ca7251bbe35625fa2fec543177abe5a41103a1fe

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Fri Jan 13 10:32:59 2012 +0000

rtpptdemux: plug pad leak in error code path

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

Don't leak srcpad if there are no caps.

https://bugzilla.gnome.org/show_bug.cgi?id=667820

---

 gst/rtpmanager/gstrtpptdemux.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gst/rtpmanager/gstrtpptdemux.c b/gst/rtpmanager/gstrtpptdemux.c
index 0679438..630212f 100644
--- a/gst/rtpmanager/gstrtpptdemux.c
+++ b/gst/rtpmanager/gstrtpptdemux.c
@@ -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);



More information about the gstreamer-commits mailing list