From 044fde0583993fae3ec3c511ac0a5058c5745302 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 13 Apr 2001 21:36:09 +0000 Subject: Plug leaks. * camel-object.c (camel_object_hook_event): * camel-uid-cache.c (camel_uid_cache_get_new_uids): * camel-url.c (camel_url_new_with_base): Plug leaks. * camel-remote-store.c (camel_remote_store_init): Don't re-initialize the folders hash table. * providers/imap/camel-imap-store.c (imap_disconnect): Free authtypes since they'll be re-read on re-connect. (get_folder_info): Free folderinfos that we're discarding from the list. svn path=/trunk/; revision=9302 --- camel/camel-object.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'camel/camel-object.c') diff --git a/camel/camel-object.c b/camel/camel-object.c index 53e7069653..bdb17fa177 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -690,6 +690,7 @@ camel_object_hook_event (CamelObject * obj, const gchar * name, { GSList *hooklist; CamelHookPair *pair; + gpointer old_name, old_hooklist; g_return_if_fail (CAMEL_IS_OBJECT (obj)); g_return_if_fail (name); @@ -703,10 +704,16 @@ camel_object_hook_event (CamelObject * obj, const gchar * name, pair->func = hook; pair->user_data = user_data; - hooklist = g_hash_table_lookup (obj->event_to_hooklist, name); - hooklist = g_slist_prepend (hooklist, pair); - g_hash_table_insert (obj->event_to_hooklist, g_strdup (name), - hooklist); + if (g_hash_table_lookup_extended (obj->event_to_hooklist, name, + &old_name, &old_hooklist)) { + hooklist = g_slist_prepend (old_hooklist, pair); + g_hash_table_insert (obj->event_to_hooklist, old_name, + hooklist); + } else { + hooklist = g_slist_prepend (NULL, pair); + g_hash_table_insert (obj->event_to_hooklist, g_strdup (name), + hooklist); + } } void -- cgit