[farsight2/master] Fix some unsafe code in add_output_ghostpad

Olivier Crête olivier.crete at collabora.co.uk
Mon Dec 22 16:54:53 PST 2008


---
 gst/fsrtpconference/fs-rtp-substream.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index f98a1b3..10e543e 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -992,6 +992,8 @@ fs_rtp_sub_stream_add_output_ghostpad_unlock (FsRtpSubStream *substream,
   GstPad *valve_srcpad;
   gchar *padname = NULL;
   GstPad *ghostpad = NULL;
+  gboolean receiving;
+  FsCodec *codec = NULL;
 
   g_assert (substream->priv->output_ghostpad == NULL);
 
@@ -1047,15 +1049,19 @@ fs_rtp_sub_stream_add_output_ghostpad_unlock (FsRtpSubStream *substream,
       substream->ssrc, substream->pt,
       FS_CODEC_ARGS (substream->codec));
 
+  receiving = substream->priv->receiving;
+  codec = fs_codec_copy (substream->codec);
+
   FS_RTP_SESSION_UNLOCK (substream->priv->session);
+
   g_signal_emit (substream, signals[SRC_PAD_ADDED], 0,
-                 ghostpad, substream->codec);
+                 ghostpad, codec);
   g_signal_emit (substream, signals[CODEC_CHANGED], 0);
 
-  FS_RTP_SESSION_LOCK (substream->priv->session);
-  if (substream->priv->receiving)
+  fs_codec_destroy (codec);
+
+  if (receiving)
     g_object_set (substream->priv->valve, "drop", FALSE, NULL);
-  FS_RTP_SESSION_UNLOCK (substream->priv->session);
 
   return TRUE;
 }
-- 
1.5.6.5




More information about the farsight-commits mailing list