[farsight2/master] Fix memory leaks

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:21:19 PST 2008


---
 gst/fsrtpconference/fs-rtp-session.c |    5 ++++-
 gst/fsrtpconference/fs-rtp-stream.c  |    2 ++
 tests/check/main/rtpconference.c     |    2 ++
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 92360a4..d7c66cd 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -2343,7 +2343,6 @@ fs_rtp_session_verify_send_codec_bin_locked (FsRtpSession *self, GError **error)
     if (fs_codec_are_equal (codec, self->priv->current_send_codec))
     {
       ret = TRUE;
-      fs_codec_destroy (codec);
       goto done;
     }
 
@@ -2373,6 +2372,7 @@ fs_rtp_session_verify_send_codec_bin_locked (FsRtpSession *self, GError **error)
     if (codecbin) {
       self->priv->send_codecbin = codecbin;
       self->priv->current_send_codec = codec;
+      codec = NULL;
 
       g_signal_emit_by_name (self, "send-codec-changed");
     }
@@ -2387,6 +2387,9 @@ fs_rtp_session_verify_send_codec_bin_locked (FsRtpSession *self, GError **error)
 
  done:
 
+  if (codec)
+    fs_codec_destroy (codec);
+
   return ret;
 }
 
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 41d30a9..afcab9e 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -524,6 +524,8 @@ fs_rtp_stream_set_remote_codecs (FsStream *stream,
 
   if (fs_rtp_session_negotiate_codecs (self->priv->session, remote_codecs,
           stream, error)) {
+    if (self->remote_codecs)
+      fs_codec_list_destroy (self->remote_codecs);
     self->remote_codecs = fs_codec_list_copy (remote_codecs);
     return TRUE;
   } else {
diff --git a/tests/check/main/rtpconference.c b/tests/check/main/rtpconference.c
index ab9212e..6a24a4e 100644
--- a/tests/check/main/rtpconference.c
+++ b/tests/check/main/rtpconference.c
@@ -698,6 +698,8 @@ GST_START_TEST (test_rtpconference_errors)
       error->code == FS_ERROR_CONSTRUCTION,
       "The wrong domain or code (%d) was returned", error->code);
 
+  g_clear_error (&error);
+
   g_object_unref (participant);
 
   cleanup_simple_conference (dat);
-- 
1.5.6.5




More information about the farsight-commits mailing list