rtpptdemux: fix leak of caps when ignoring a pt
authorMatthew Waters <matthew@centricular.com>
Wed, 17 Nov 2021 06:27:13 +0000 (17:27 +1100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 25 Mar 2022 05:44:36 +0000 (05:44 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2025>

subprojects/gst-plugins-good/gst/rtpmanager/gstrtpptdemux.c

index e588a3f..6759e69 100644 (file)
@@ -477,8 +477,12 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     if (!caps)
       goto no_caps;
 
-    if (gst_rtp_pt_demux_pt_is_ignored (rtpdemux, pt))
+    /* must be after the get_caps() call as get_caps() may cause external code
+     * (e.g. rtpbin) to update the ignored-pt list */
+    if (gst_rtp_pt_demux_pt_is_ignored (rtpdemux, pt)) {
+      gst_clear_caps (&caps);
       goto ignored;
+    }
 
     klass = GST_ELEMENT_GET_CLASS (rtpdemux);
     templ = gst_element_class_get_pad_template (klass, "src_%u");