diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-06-15 22:49:26 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-06-18 19:42:39 +0800 |
commit | 88a372b27e655eaaa27e7b806a1adc360b1583b6 (patch) | |
tree | ddefa0742eee8d25137ee4d1e911e2e94565aa37 | |
parent | 0c2a0824be34b35528b261220d6703b33f5d868c (diff) | |
download | gsoc2013-evolution-88a372b27e655eaaa27e7b806a1adc360b1583b6.tar.gz gsoc2013-evolution-88a372b27e655eaaa27e7b806a1adc360b1583b6.tar.zst gsoc2013-evolution-88a372b27e655eaaa27e7b806a1adc360b1583b6.zip |
Fix some memory leaks
-rw-r--r-- | mail/e-mail-backend.c | 11 | ||||
-rw-r--r-- | mail/e-mail-display.c | 17 | ||||
-rw-r--r-- | mail/e-mail-request.c | 1 | ||||
-rw-r--r-- | widgets/misc/e-web-view.c | 3 |
4 files changed, 21 insertions, 11 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 19150cca03..b0e4326088 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -654,11 +654,15 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, CamelFolder *folder = NULL; if (mail_folder_cache_get_folder_from_uri ( - folder_cache, folder_uri, &folder)) + folder_cache, folder_uri, &folder)) { if (folder != NULL && !mail_folder_cache_get_folder_info_flags ( - folder_cache, folder, &flags)) + folder_cache, folder, &flags)) { + g_free (folder_uri); g_return_if_reached (); + } + } + if (folder != NULL) g_object_unref (folder); } @@ -667,6 +671,9 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache, event, store, folder_uri, new_messages, msg_uid, msg_sender, msg_subject); + if (folder_uri) + g_free (folder_uri); + folder_type = (flags & CAMEL_FOLDER_TYPE_MASK); target->is_inbox = (folder_type == CAMEL_FOLDER_TYPE_INBOX); diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 1ca8bcc8a9..461fb8f72d 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -1680,7 +1680,6 @@ e_mail_display_reload (EMailDisplay *display) GHashTable *table; GHashTableIter table_iter; gpointer key, val; - gchar separator; g_return_if_fail (E_IS_MAIL_DISPLAY (display)); @@ -1695,23 +1694,23 @@ e_mail_display_reload (EMailDisplay *display) return; } - base = g_strndup (uri, strstr (uri, "?") - uri); + base = g_strndup (uri, strstr (uri, "?") - uri + 1); new_uri = g_string_new (base); g_free (base); table = soup_form_decode (strstr (uri, "?") + 1); - g_hash_table_insert (table, g_strdup ("mode"), g_strdup_printf ("%d", display->priv->mode)); - g_hash_table_insert (table, g_strdup ("headers_collapsable"), g_strdup_printf ("%d", display->priv->headers_collapsable)); - g_hash_table_insert (table, g_strdup ("headers_collapsed"), g_strdup_printf ("%d", display->priv->headers_collapsed)); + g_hash_table_replace (table, g_strdup ("mode"), g_strdup_printf ("%d", display->priv->mode)); + g_hash_table_replace (table, g_strdup ("headers_collapsable"), g_strdup_printf ("%d", display->priv->headers_collapsable)); + g_hash_table_replace (table, g_strdup ("headers_collapsed"), g_strdup_printf ("%d", display->priv->headers_collapsed)); g_hash_table_iter_init (&table_iter, table); - separator = '?'; while (g_hash_table_iter_next (&table_iter, &key, &val)) { - g_string_append_printf (new_uri, "%c%s=%s", separator, + g_string_append_printf (new_uri, "%s=%s&", (gchar *) key, (gchar *) val); - if (separator == '?') - separator = '&'; + /* Free the value as Soup constructs the GHashTable without + * value_destroy_func */ + g_free (val); } e_web_view_load_uri (web_view, new_uri->str); diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c index 5805a10b26..544f5f3f51 100644 --- a/mail/e-mail-request.c +++ b/mail/e-mail-request.c @@ -228,6 +228,7 @@ handle_contact_photo_request (GSimpleAsyncResult *res, camel_address_decode ((CamelAddress *) cia, (const gchar *) photo_name); photopart = em_utils_contact_photo ( registry, cia, only_local_photo, cancellable); + g_object_unref (cia); if (!photopart) { gsize len; diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index 956f721eed..f3728dbd5d 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -937,6 +937,8 @@ web_view_button_press_event (GtkWidget *widget, break; } } + + g_object_unref (test); } if (event != NULL && event->button != 3) @@ -1062,6 +1064,7 @@ web_view_extract_uri (EWebView *web_view, WEBKIT_WEB_VIEW (web_view), event); g_object_get (result, "context", &context, "link-uri", &uri, NULL); + g_object_unref (result); if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) return uri; |