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/image-store.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/image-store.c')
-rw-r--r-- | libpurple/image-store.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libpurple/image-store.c b/libpurple/image-store.c index f92e53dbc2..4eeb596afb 100644 --- a/libpurple/image-store.c +++ b/libpurple/image-store.c @@ -219,13 +219,10 @@ _purple_image_store_init(void) void _purple_image_store_uninit(void) { - g_slist_free_full(perm_images, g_object_unref); - perm_images = NULL; + g_clear_slist(&perm_images, g_object_unref); g_hash_table_foreach(temp_images, cancel_temporary, NULL); - g_hash_table_destroy(temp_images); - temp_images = NULL; + g_clear_pointer(&temp_images, g_hash_table_destroy); - g_hash_table_destroy(id_to_image); - id_to_image = NULL; + g_clear_pointer(&id_to_image, g_hash_table_destroy); } |