telepathy-farstream: fix a couple of memory leaks

Olivier CrĂȘte tester at kemper.freedesktop.org
Sun Dec 18 16:27:16 UTC 2016


Module: telepathy-farstream
Branch: master
Commit: 93380c723f999ee9d387cbf2de08dbf12e908fec
URL:    http://cgit.freedesktop.org/telepathy/telepathy-farstream/commit/?id=93380c723f999ee9d387cbf2de08dbf12e908fec

Author: Fabrice Bellet <fabrice at bellet.info>
Date:   Mon Jul 18 14:30:48 2016 +0200

fix a couple of memory leaks

https://bugs.freedesktop.org/show_bug.cgi?id=99124

---

 telepathy-farstream/call-content.c | 7 +++++--
 telepathy-farstream/call-stream.c  | 7 ++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/telepathy-farstream/call-content.c b/telepathy-farstream/call-content.c
index 751b606..3f26063 100644
--- a/telepathy-farstream/call-content.c
+++ b/telepathy-farstream/call-content.c
@@ -1194,6 +1194,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
           g_warning ("Could not set codec preference: %s", myerror->message);
           g_clear_error (&myerror);
         }
+      g_list_free_full (codec_prefs, (GDestroyNotify)fs_codec_destroy);
     }
 
   /* First complete so we get signalled and the preferences can be set, then
@@ -1775,7 +1776,7 @@ fscodecs_to_media_descriptions (TfCallContent *self, GList *codecs)
   GPtrArray *tpcodecs = g_ptr_array_new ();
   GList *item;
   GList *resend_codecs = NULL;
-  GHashTable *retval;
+  GHashTable *retval = NULL;
   GPtrArray *rtp_hdrext = NULL;
   GHashTable *rtcp_fb = NULL;
   GPtrArray *interfaces;
@@ -1785,7 +1786,7 @@ fscodecs_to_media_descriptions (TfCallContent *self, GList *codecs)
         self->last_sent_codecs, codecs);
 
   if (!self->current_media_description && !resend_codecs)
-    return NULL;
+    goto out;
 
   if ((self->current_media_description && self->current_has_rtp_hdrext)
       || self->has_rtp_hdrext)
@@ -1934,6 +1935,8 @@ fscodecs_to_media_descriptions (TfCallContent *self, GList *codecs)
       G_TYPE_STRV, interfaces->pdata);
   g_ptr_array_free (interfaces, FALSE);
 
+out:
+  g_ptr_array_unref (tpcodecs);
   return retval;
 }
 
diff --git a/telepathy-farstream/call-stream.c b/telepathy-farstream/call-stream.c
index bbec0c9..b0d073d 100644
--- a/telepathy-farstream/call-stream.c
+++ b/telepathy-farstream/call-stream.c
@@ -1430,6 +1430,7 @@ static GValueArray *
 fscandidate_to_tpcandidate (TfCallStream *stream, FsCandidate *candidate)
 {
   GHashTable *extra_info;
+  GValueArray *tpcandidate;
 
   extra_info = tp_asv_new (NULL, NULL);
 
@@ -1464,12 +1465,16 @@ fscandidate_to_tpcandidate (TfCallStream *stream, FsCandidate *candidate)
     }
 
 
-  return tp_value_array_build (4,
+  tpcandidate = tp_value_array_build (4,
       G_TYPE_UINT, candidate->component_id,
       G_TYPE_STRING, candidate->ip,
       G_TYPE_UINT, candidate->port,
       TP_HASH_TYPE_CANDIDATE_INFO, extra_info,
       G_TYPE_INVALID);
+
+  g_hash_table_unref (extra_info);
+
+  return tpcandidate;
 }
 
 static void



More information about the telepathy-commits mailing list