pidgin/pidgin

Addressed comments from pull request #633 review
memory-leaks
2019-12-20, Fabrice Bellet
8785aa7408b0
Addressed comments from pull request #633 review
--- a/libpurple/buddylist.c Sun Nov 10 17:47:33 2019 +0100
+++ b/libpurple/buddylist.c Fri Dec 20 10:38:12 2019 +0100
@@ -804,9 +804,6 @@
{
PurpleBuddyListClass *klass = NULL;
- if (!purplebuddylist)
- return NULL;
-
g_return_if_fail(PURPLE_IS_BUDDY_LIST(purplebuddylist));
klass = PURPLE_BUDDY_LIST_GET_CLASS(purplebuddylist);
--- a/libpurple/media.h Sun Nov 10 17:47:33 2019 +0100
+++ b/libpurple/media.h Fri Dec 20 10:38:12 2019 +0100
@@ -110,7 +110,7 @@
*
* Gets the PurpleAccount this media session is on.
*
- * Returns: (transfer none): The account retrieved.
+ * Returns: (transfer full): The account retrieved.
*/
PurpleAccount *purple_media_get_account(PurpleMedia *media);
--- a/libpurple/protocols/jabber/jabber.c Sun Nov 10 17:47:33 2019 +0100
+++ b/libpurple/protocols/jabber/jabber.c Fri Dec 20 10:38:12 2019 +0100
@@ -1686,12 +1686,6 @@
g_free(js->google_relay_token);
g_free(js->google_relay_host);
- if (js->sessions) {
- g_hash_table_remove_all(js->sessions);
- g_hash_table_unref(js->sessions);
- js->sessions = NULL;
- }
-
g_free(js);
purple_connection_set_protocol_data(gc, NULL);
--- a/libpurple/protocols/jabber/jingle/jingle.c Sun Nov 10 17:47:33 2019 +0100
+++ b/libpurple/protocols/jabber/jingle/jingle.c Fri Dec 20 10:38:12 2019 +0100
@@ -433,6 +433,7 @@
if (js->sessions) {
GList *list = g_hash_table_get_values(js->sessions);
g_list_free_full(list, g_object_unref);
+ g_clear_pointer(&js->sessions, g_hash_table_unref);
}
}
--- a/pidgin/gtkrequest.c Sun Nov 10 17:47:33 2019 +0100
+++ b/pidgin/gtkrequest.c Fri Dec 20 10:38:12 2019 +0100
@@ -2485,14 +2485,14 @@
static void
pidgin_window_detach_children(GtkWindow* win)
{
- GList *it, *l;
+ GList *it;
GtkWindow *par;
g_return_if_fail(win != NULL);
par = gtk_window_get_transient_for(win);
- l = it = gtk_window_list_toplevels();
- for (it = g_list_first(it); it != NULL; it = g_list_next(it)) {
+ it = gtk_window_list_toplevels();
+ for (it = g_list_first(it); it != NULL; it = g_list_delete_link(it, it)) {
GtkWindow *child = GTK_WINDOW(it->data);
if (gtk_window_get_transient_for(child) != win)
continue;
@@ -2506,7 +2506,6 @@
}
gtk_window_set_transient_for(child, par);
}
- g_list_free(l);
}
static void