rtpmux: Fix leak
authorOlivier Crête <olivier.crete@collabora.co.uk>
Tue, 28 Apr 2009 19:58:41 +0000 (15:58 -0400)
committerTim-Philipp Müller <tim@centricular.net>
Sun, 16 Dec 2012 16:33:46 +0000 (16:33 +0000)
Fixed a leak discovered by Laurent Glayal <spegle@yahoo.fr>

gst/rtpmanager/gstrtpmux.c

index d7a9b47..e62f8a1 100644 (file)
@@ -378,20 +378,21 @@ gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps)
     padpriv->have_clock_base = TRUE;
   }
 
-  caps = gst_caps_copy (caps);
+  caps = gst_caps_make_writable (caps);
 
   gst_caps_set_simple (caps,
       "clock-base", G_TYPE_UINT, rtp_mux->ts_base,
       "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
 
+  gst_caps_ref (caps);
+
   GST_DEBUG_OBJECT (rtp_mux,
       "setting caps %" GST_PTR_FORMAT " on src pad..", caps);
   ret = gst_pad_set_caps (rtp_mux->srcpad, caps);
 
   if (ret)
     gst_caps_replace (&padpriv->out_caps, caps);
-  else
-    gst_caps_unref (caps);
+  gst_caps_unref (caps);
 
 out:
   gst_object_unref (rtp_mux);