From 08482043fc1f5ce69bb669dd24e17107b94d346f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 22 Mar 2023 03:21:17 -0500 Subject: Fix leaks from g_list_model_get_item It returns a new reference, which needs to be unref'd. Testing Done: Compiled only, and ran tests, though these issues didn't show up in valgrind anyway. Reviewed at https://reviews.imfreedom.org/r/2377/ --- libpurple/protocols/ircv3/purpleircv3messagehandlers.c | 1 + libpurple/purplecontactmanager.h | 4 ++-- libpurple/tests/test_contact_manager.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'libpurple') diff --git a/libpurple/protocols/ircv3/purpleircv3messagehandlers.c b/libpurple/protocols/ircv3/purpleircv3messagehandlers.c index 08d813f211..9151f59d8d 100644 --- a/libpurple/protocols/ircv3/purpleircv3messagehandlers.c +++ b/libpurple/protocols/ircv3/purpleircv3messagehandlers.c @@ -110,6 +110,7 @@ purple_ircv3_message_handler_privmsg(GHashTable *tags, purple_contact_info_set_username(PURPLE_CONTACT_INFO(contact), source); purple_contact_manager_add(contact_manager, contact); } + g_clear_object(&contact); target = params[0]; conversation_manager = purple_conversation_manager_get_default(); diff --git a/libpurple/purplecontactmanager.h b/libpurple/purplecontactmanager.h index 2c6a92168f..146fb10c34 100644 --- a/libpurple/purplecontactmanager.h +++ b/libpurple/purplecontactmanager.h @@ -119,7 +119,7 @@ GListModel *purple_contact_manager_get_all(PurpleContactManager *manager, Purple * Looks for a [class@Purple.Contact] that belongs to @account with a username * of @username. * - * Returns: (transfer none): The [class@Purple.Contact] if found, otherwise + * Returns: (transfer full): The [class@Purple.Contact] if found, otherwise * %NULL. * * Since: 3.0.0 @@ -134,7 +134,7 @@ PurpleContact *purple_contact_manager_find_with_username(PurpleContactManager *m * * Looks for a [class@Purple.Contact] that belongs to @account with a id of @id. * - * Returns: (transfer none): The [class@Purple.Contact] if found, otherwise + * Returns: (transfer full): The [class@Purple.Contact] if found, otherwise * %NULL. * * Since: 3.0.0 diff --git a/libpurple/tests/test_contact_manager.c b/libpurple/tests/test_contact_manager.c index 010f3584ad..7b21ab7a46 100644 --- a/libpurple/tests/test_contact_manager.c +++ b/libpurple/tests/test_contact_manager.c @@ -292,6 +292,7 @@ test_purple_contact_manager_add_buddy(void) { contact = purple_contact_manager_find_with_id(manager, account, id); g_assert_nonnull(contact); g_assert_true(PURPLE_IS_CONTACT(contact)); + g_clear_object(&contact); /* Verify that we can find the created contact via username. */ contact = purple_contact_manager_find_with_username(manager, account, -- cgit v1.2.1