diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2023-03-21 00:39:45 -0500 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2023-03-21 00:39:45 -0500 |
commit | 1b4f76976e1a069831b98518588f587be79b122c (patch) | |
tree | 0558873858c1d4b3fb27069c4932d729e3a7f397 /libpurple/buddylist.c | |
parent | ae674f38b973f59afa38f5fbcb8b4c069188e59f (diff) | |
download | pidgin-1b4f76976e1a069831b98518588f587be79b122c.tar.gz |
Use g_clear_* helpers where useful
That is:
* when the variable is set to `NULL` right after freeing
* when the variable is checked for non-`NULL` before freeing
* when the variable is a global (because they should be set to `NULL`, even if we don't really claim that things can be re-init'd)
Testing Done:
Compiled, and ran tests in valgrind.
Reviewed at https://reviews.imfreedom.org/r/2369/
Diffstat (limited to 'libpurple/buddylist.c')
-rw-r--r-- | libpurple/buddylist.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c index 5e48f74487..81abd33acc 100644 --- a/libpurple/buddylist.c +++ b/libpurple/buddylist.c @@ -2179,16 +2179,12 @@ purple_blist_uninit(void) purple_debug_info("buddylist", "Destroying"); - g_hash_table_destroy(buddies_cache); - g_hash_table_destroy(groups_cache); - - buddies_cache = NULL; - groups_cache = NULL; + g_clear_pointer(&buddies_cache, g_hash_table_destroy); + g_clear_pointer(&groups_cache, g_hash_table_destroy); g_clear_object(&purplebuddylist); - g_free(localized_default_group_name); - localized_default_group_name = NULL; + g_clear_pointer(&localized_default_group_name, g_free); purple_signals_disconnect_by_handle(purple_blist_get_handle()); purple_signals_unregister_by_instance(purple_blist_get_handle()); |