[telepathy-idle/master] Fix two valgrind-reported leaks
Jonathon Jongsma
jonathon.jongsma at collabora.co.uk
Tue Oct 6 20:46:23 PDT 2009
For some reason, we were strduping the channel name needlessly in
_channel_normalize_func()
Also, we forgot to free the bodies returned from idle_text_encode_and_split()
---
src/idle-handles.c | 8 ++------
src/idle-text.c | 1 +
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/idle-handles.c b/src/idle-handles.c
index 97c9a63..4d5978b 100644
--- a/src/idle-handles.c
+++ b/src/idle-handles.c
@@ -139,16 +139,12 @@ static gchar *_nick_normalize_func(TpHandleRepoIface *repo, const gchar *id, gpo
}
static gchar *_channel_normalize_func(TpHandleRepoIface *repo, const gchar *id, gpointer ctx, GError **error) {
- gchar *channel = g_strdup(id);
-
- if (!_channelname_is_valid(channel)) {
+ if (!_channelname_is_valid(id)) {
g_set_error(error, TP_ERRORS, TP_ERROR_INVALID_HANDLE, "invalid channel ID");
return NULL;
}
- gchar *normalized = g_utf8_strdown(channel, -1);
-
- g_free(channel);
+ gchar *normalized = g_utf8_strdown(id, -1);
return normalized;
}
diff --git a/src/idle-text.c b/src/idle-text.c
index ccafa1e..6ba8254 100644
--- a/src/idle-text.c
+++ b/src/idle-text.c
@@ -182,6 +182,7 @@ void idle_text_send(GObject *obj, guint type, const gchar *recipient, const gcha
}
g_strfreev(messages);
+ g_strfreev(bodies);
tp_svc_channel_type_text_return_from_send(context);
}
--
1.5.6.5
More information about the telepathy-commits
mailing list