[farsight2/master] rtpsession: Only add stream to list if its creation worked

Olivier Crête olivier.crete at collabora.co.uk
Fri Nov 20 16:12:47 PST 2009


---
 gst/fsrtpconference/fs-rtp-session.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index eda0545..80c08b2 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1584,13 +1584,16 @@ fs_rtp_session_new_stream (FsSession *session,
           _stream_ssrc_added_cb,
           self, error));
 
-  FS_RTP_SESSION_LOCK (self);
-  self->priv->streams = g_list_append (self->priv->streams, new_stream);
-  self->priv->streams_cookie++;
-  FS_RTP_SESSION_UNLOCK (self);
 
-  g_object_weak_ref (G_OBJECT (new_stream), _remove_stream, self);
+  if (new_stream)
+  {
+    FS_RTP_SESSION_LOCK (self);
+    self->priv->streams = g_list_append (self->priv->streams, new_stream);
+    self->priv->streams_cookie++;
+    FS_RTP_SESSION_UNLOCK (self);
 
+    g_object_weak_ref (G_OBJECT (new_stream), _remove_stream, self);
+  }
   fs_rtp_session_has_disposed_exit (self);
   return new_stream;
 }
-- 
1.5.6.5



More information about the farsight-commits mailing list