From 390a8443583226f8fbf4fb6f83d908a788cb2afc Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Mon, 18 Jul 2016 14:30:48 +0200 Subject: [PATCH] fix a couple of memory leaks --- 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 512c530..e2d729c 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 -- 2.5.5