gst/rtpmanager/: Avoid leaking pads in the RTP manager.
authorPeter Kjellerstedt <pkj@axis.com>
Wed, 9 Apr 2008 22:27:50 +0000 (22:27 +0000)
committerPeter Kjellerstedt <pkj@axis.com>
Wed, 9 Apr 2008 22:27:50 +0000 (22:27 +0000)
Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (free_session):
* gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_finalize):
Avoid leaking pads in the RTP manager.

ChangeLog
gst/rtpmanager/gstrtpbin.c
gst/rtpmanager/gstrtpsession.c

index de536dc4eb725cb3c6bff931848f65e144b52b25..e4645c44f5a68956e6235c5263288e7c670ee0ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-10  Peter Kjellerstedt  <pkj@axis.com>
+
+       * gst/rtpmanager/gstrtpbin.c: (free_session):
+       * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_finalize):
+       Avoid leaking pads in the RTP manager.
+
 2008-04-09  Jan Schmidt  <Jan.Schmidt@sun.com>
 
        * gst/nsf/nes_apu.c: (apu_process):
index 4f580f48ffa2e5a23c3d6edc821abe88a82fecbb..5f781d8c7f3ae50b7a7d475b05cbb8e912bbc396 100644 (file)
@@ -524,6 +524,21 @@ free_session (GstRtpBinSession * sess)
   gst_element_set_state (sess->session, GST_STATE_NULL);
   gst_element_set_state (sess->demux, GST_STATE_NULL);
 
+  if (sess->recv_rtp_sink != NULL)
+    gst_element_release_request_pad (sess->session, sess->recv_rtp_sink);
+  if (sess->recv_rtp_src != NULL)
+    gst_object_unref (sess->recv_rtp_src);
+  if (sess->recv_rtcp_sink != NULL)
+    gst_element_release_request_pad (sess->session, sess->recv_rtcp_sink);
+  if (sess->sync_src != NULL)
+    gst_object_unref (sess->sync_src);
+  if (sess->send_rtp_sink != NULL)
+    gst_element_release_request_pad (sess->session, sess->send_rtp_sink);
+  if (sess->send_rtp_src != NULL)
+    gst_object_unref (sess->send_rtp_src);
+  if (sess->send_rtcp_src != NULL)
+    gst_element_release_request_pad (sess->session, sess->send_rtcp_src);
+
   gst_bin_remove (GST_BIN_CAST (bin), sess->session);
   gst_bin_remove (GST_BIN_CAST (bin), sess->demux);
 
index 6de1d3f349716f6deb8397e1990f9a63da3a82db..3f7053d73443ca94c99ffd5cc268e958a63bf4fe 100644 (file)
@@ -705,6 +705,15 @@ gst_rtp_session_finalize (GObject * object)
 
   rtpsession = GST_RTP_SESSION (object);
 
+  if (rtpsession->recv_rtp_sink != NULL)
+    gst_object_unref (rtpsession->recv_rtp_sink);
+  if (rtpsession->recv_rtcp_sink != NULL)
+    gst_object_unref (rtpsession->recv_rtcp_sink);
+  if (rtpsession->send_rtp_sink != NULL)
+    gst_object_unref (rtpsession->send_rtp_sink);
+  if (rtpsession->send_rtcp_src != NULL)
+    gst_object_unref (rtpsession->send_rtcp_src);
+
   g_hash_table_destroy (rtpsession->priv->ptmap);
   g_mutex_free (rtpsession->priv->lock);
   g_object_unref (rtpsession->priv->session);