aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2016-04-17 06:32:27 -0300
committerdequis <dx@dxzone.com.ar>2016-04-17 06:32:27 -0300
commita244877191da5159d56e34dca57e881a639061ce (patch)
treef33708227143b53e256d84c8900a56f573b4e067 /protocols/twitter
parent991c75fbf4c4bc0ab2ae6f8b983a092080630b14 (diff)
twitter: Fix a couple of leaks of mutes_ids and retweets_ids
Just freeing the list on logout and when removing items from them. Also remove the "checking mutes" debug which is disproportionately noisy compared to the rest of the protocol.
Diffstat (limited to 'protocols/twitter')
-rw-r--r--protocols/twitter/twitter.c6
-rw-r--r--protocols/twitter/twitter_lib.c12
2 files changed, 10 insertions, 8 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index e543f86e..4fe509bb 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -686,6 +686,12 @@ static void twitter_logout(struct im_connection *ic)
b_event_remove(td->filter_update_id);
}
+ g_slist_foreach(td->mutes_ids, (GFunc) g_free, NULL);
+ g_slist_free(td->mutes_ids);
+
+ g_slist_foreach(td->noretweets_ids, (GFunc) g_free, NULL);
+ g_slist_free(td->noretweets_ids);
+
http_close(td->stream);
twitter_filter_remove_all(ic);
oauth_info_free(td->oauth_info);
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index 82765201..77f487ae 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -954,13 +954,7 @@ static void twitter_status_show(struct im_connection *ic, struct twitter_xml_sta
/* Check this is not a tweet that should be muted */
uid_str = g_strdup_printf("%" PRIu64, status->user->uid);
- if (getenv("BITLBEE_DEBUG")) {
- GSList *item;
- fprintf(stderr, "Checking mutes; this uid=%s\n", uid_str);
- for (item = td->mutes_ids; item != NULL; item = item->next) {
- fprintf(stderr, " id: %s\n", (char *)item->data);
- }
- }
+
if (g_slist_find_custom(td->mutes_ids, uid_str, (GCompareFunc)strcmp)) {
g_free(uid_str);
return;
@@ -1163,7 +1157,9 @@ static gboolean twitter_stream_handle_event(struct im_connection *ic, json_value
uid_str = g_strdup_printf("%" PRIu64, ut->uid);
if ((found = g_slist_find_custom(td->mutes_ids, uid_str,
(GCompareFunc)strcmp))) {
- td->mutes_ids = g_slist_remove(td->mutes_ids, found);
+ char *found_str = found->data;
+ td->mutes_ids = g_slist_delete_link(td->mutes_ids, found);
+ g_free(found_str);
}
g_free(uid_str);
twitter_log(ic, "Unmuted user %s", ut->screen_name);