From 24feba20337274a86d51700fa0e8f56ce378c902 Mon Sep 17 00:00:00 2001 From: Matthew Loper Date: Thu, 17 Aug 2000 14:19:02 +0000 Subject: Whole buncha leak fixes thanks to Purify svn path=/trunk/; revision=4862 --- camel/ChangeLog | 2 ++ camel/providers/imap/camel-imap-folder.c | 5 +++-- camel/providers/mbox/camel-mbox-store.c | 3 ++- mail/ChangeLog | 13 +++++++++++++ mail/folder-browser.c | 3 +++ mail/mail-display.c | 5 ++++- mail/mail-local.c | 1 + mail/mail-ops.c | 4 ++-- mail/mail-threads.c | 7 ++++++- mail/message-list.c | 3 +++ mail/session.c | 8 ++++---- 11 files changed, 43 insertions(+), 11 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 0572761257..17bccfc015 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -7,6 +7,8 @@ * camel-object.c (camel_type_lock_up): Don't leave the type system locked when a bad unlock happens. + * providers/mbox/camel-mbox-store.c (get_folder): Fix a leak. + 2000-08-15 Peter Williams * providers/imap/camel-imap-folder.c (imap_copy_message_to): Typo fix. diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 84a0805727..2118554607 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -969,6 +969,7 @@ imap_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex) d(fprintf (stderr, "*** We're returning... ***\n")); + g_free (mesg); return msg; #if 0 @@ -1085,7 +1086,7 @@ imap_get_summary_internal (CamelFolder *folder, CamelException *ex) char *result, *q, *node; const char *received; char *summary_specifier; - struct _header_raw *h, *tail = NULL; + struct _header_raw *h = NULL, *tail = NULL; num = imap_get_message_count_internal (folder, ex); @@ -1252,7 +1253,7 @@ imap_get_summary_internal (CamelFolder *folder, CamelException *ex) if (info->references == NULL) info->references = header_references_decode (header_raw_find (&h, "in-reply-to", NULL)); - while (h->next) { + while (h) { struct _header_raw *next = h->next; g_free (h->name); diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c index e90c90275e..ed56e84407 100644 --- a/camel/providers/mbox/camel-mbox-store.c +++ b/camel/providers/mbox/camel-mbox-store.c @@ -148,7 +148,8 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, name); g_free (name); return NULL; - } + } else + g_free (name); new_folder = CAMEL_FOLDER (camel_object_new (CAMEL_MBOX_FOLDER_TYPE)); diff --git a/mail/ChangeLog b/mail/ChangeLog index efa7669577..0bb4298961 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -21,6 +21,19 @@ * mail-format.c (get_url_for_icon): Copy the url_path so that it can't get freed under us. + * mail-threads.c (mail_operation_queue): Fix a leak. + + * mail-ops.c (mail_do_display_message): Fix another leak. + + * message-list.c (message_list_destroy): Remove the seen_id timeout + if necessary. + + * mail-local.c (mail_tool_local_uri_to_folder): Fix a leak. + + * session.c (auth_callback): Fix a leak. Almost seems as if + I've been using Purify... + + 2000-08-15 Peter Williams * message-thread.c (alloc_container): Add support for debugging diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 522a6b1804..4707351f8c 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -57,6 +57,9 @@ folder_browser_destroy (GtkObject *object) if (folder_browser->message_list) bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list)); + if (folder_browser->mail_display) + gtk_widget_destroy (GTK_WIDGET (folder_browser->mail_display)); + folder_browser_parent_class->destroy (object); } diff --git a/mail/mail-display.c b/mail/mail-display.c index a24d258511..760c45c92e 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -505,7 +505,10 @@ mail_display_init (GtkObject *object) static void mail_display_destroy (GtkObject *object) { - /* MailDisplay *mail_display = MAIL_DISPLAY (object); */ + MailDisplay *mail_display = MAIL_DISPLAY (object); + + g_datalist_clear (mail_display->data); + g_free (mail_display->data); mail_display_parent_class->destroy (object); } diff --git a/mail/mail-local.c b/mail/mail-local.c index 7548d32e8b..eb03db0dd4 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -200,6 +200,7 @@ mail_tool_local_uri_to_folder(const char *uri, CamelException *ex) folder = mail_tool_get_folder_from_urlname (storename, meta->name, FALSE, ex); camel_url_free(url); + g_free (storename); free_metainfo(meta); return folder; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 1a3ff0efe3..f90d492dd8 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1515,7 +1515,7 @@ typedef struct display_message_input_s { MessageList *ml; gchar *uid; - gint (*timeout) (gpointer); + gint (*timeout) (gpointer); } display_message_input_t; @@ -1646,7 +1646,7 @@ mail_do_display_message (MessageList *ml, const char *uid, input->uid = g_strdup (uid); input->timeout = timeout; - mail_operation_queue (&op_display_message, input, FALSE); + mail_operation_queue (&op_display_message, input, TRUE); } /* ** EDIT MESSAGES ******************************************************* */ diff --git a/mail/mail-threads.c b/mail/mail-threads.c index cf3528dfb1..8fe170eea2 100644 --- a/mail/mail-threads.c +++ b/mail/mail-threads.c @@ -300,6 +300,11 @@ mail_operation_queue (const mail_operation_spec * spec, gpointer input, } /* else add self to queue */ write (DISPATCH_WRITER, clur, sizeof (closure_t)); + /* dispatch allocates a separate buffer + * to hold the closure; it's in the pipe and + * can safely be freed + */ + g_free (clur); queue_len++; return TRUE; } @@ -865,7 +870,7 @@ get_password (com_msg_t * msg) if (button == 1 || *(msg->reply) == NULL) { *(msg->success) = FALSE; *(msg->reply) = g_strdup (_("User cancelled query.")); - } else if (button > 0) { + } else if (button >= 0) { *(msg->success) = TRUE; } diff --git a/mail/message-list.c b/mail/message-list.c index c635f3ea84..f9772fa7b0 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -676,6 +676,9 @@ message_list_destroy (GtkObject *object) if (message_list->idle_id != 0) g_source_remove(message_list->idle_id); + if (message_list->seen_id) + gtk_timeout_remove (message_list->seen_id); + if (message_list->folder) camel_object_unref (CAMEL_OBJECT (message_list->folder)); diff --git a/mail/session.c b/mail/session.c index 161536022e..b76e096abb 100644 --- a/mail/session.c +++ b/mail/session.c @@ -66,14 +66,14 @@ static char * auth_callback (CamelAuthCallbackMode mode, char *data, gboolean secret, CamelService *service, char *item, CamelException *ex) { - char *key, *ans; + char *key, *ans, *url; if (!passwords) passwords = g_hash_table_new (g_str_hash, g_str_equal); - key = g_strdup_printf ("%s:%s", - camel_url_to_string (service->url, FALSE), - item); + url = camel_url_to_string (service->url, FALSE); + key = g_strdup_printf ("%s:%s", url, item); + g_free (url); if (mode == CAMEL_AUTHENTICATOR_TELL) { if (!data) { -- cgit