[evolution] Prefer GSlice over heap allocation for short-lived structures



commit 0f0fd768f619c1745695c2a3bc910d2f5e4d705d
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 21 23:11:50 2020 +0100

    Prefer GSlice over heap allocation for short-lived structures
    
    It might be quicker to use GSlice than to allocate new memory on the heap,
    thus let's try to benefit from it.

 .../gui/contact-editor/e-contact-editor.c          | 29 +++++++-------
 .../gui/contact-editor/e-contact-quick-add.c       |  4 +-
 .../contact-list-editor/e-contact-list-editor.c    | 17 ++++++---
 src/addressbook/gui/widgets/e-addressbook-view.c   |  4 +-
 src/addressbook/gui/widgets/eab-contact-compare.c  |  4 +-
 src/addressbook/gui/widgets/eab-contact-merging.c  | 18 ++++++---
 src/addressbook/gui/widgets/eab-gui-util.c         |  4 +-
 src/calendar/gui/e-cal-data-model.c                | 16 ++++----
 src/calendar/gui/e-cal-dialogs.c                   |  4 +-
 src/calendar/gui/e-cal-model.c                     |  4 +-
 src/calendar/gui/e-cal-ops.c                       | 44 ++++++++++++++--------
 src/calendar/gui/e-calendar-view.c                 |  4 +-
 src/calendar/gui/e-comp-editor.c                   | 12 +++---
 src/calendar/gui/e-day-view.c                      |  8 ++--
 src/calendar/gui/e-to-do-pane.c                    |  4 +-
 src/calendar/gui/e-week-view.c                     |  4 +-
 src/calendar/gui/itip-utils.c                      | 15 ++++----
 src/calendar/gui/tag-calendar.c                    | 21 ++++++++---
 src/calendar/importers/icalendar-importer.c        |  4 +-
 src/e-util/e-activity-bar.c                        |  4 +-
 src/e-util/e-activity-proxy.c                      |  4 +-
 src/e-util/e-alert-sink.c                          |  4 +-
 src/e-util/e-collection-account-wizard.c           |  4 +-
 src/e-util/e-config-lookup-result-simple.c         |  4 +-
 src/e-util/e-config-lookup.c                       |  8 ++--
 src/e-util/e-content-request.c                     |  4 +-
 src/e-util/e-html-editor.c                         |  4 +-
 src/e-util/e-import-assistant.c                    |  4 +-
 src/e-util/e-mail-signature-editor.c               |  4 +-
 src/e-util/e-misc-utils.c                          |  4 +-
 src/e-util/e-name-selector-list.c                  |  4 +-
 src/e-util/e-simple-async-result.c                 |  4 +-
 src/e-util/e-source-selector.c                     |  4 +-
 src/e-util/e-text.c                                |  4 +-
 src/e-util/e-webdav-browser.c                      | 22 +++++------
 src/libemail-engine/e-mail-session.c               |  4 +-
 src/mail/e-mail-config-composing-page.c            |  4 +-
 src/mail/e-mail-config-identity-page.c             |  4 +-
 src/mail/e-mail-notes.c                            |  8 ++--
 src/mail/e-mail-reader-utils.c                     | 22 +++++++----
 src/mail/e-mail-reader.c                           | 10 ++---
 src/mail/e-mail-templates.c                        |  4 +-
 src/mail/em-composer-utils.c                       |  8 ++--
 src/mail/em-folder-properties.c                    | 12 +++---
 src/mail/mail-send-recv.c                          |  4 +-
 src/mail/message-list.c                            |  4 +-
 .../accounts-window/e-accounts-window-editors.c    |  4 +-
 src/modules/addressbook/eab-composer-util.c        |  6 +--
 .../backup-restore/evolution-backup-restore.c      |  4 +-
 .../book-config-ldap/evolution-book-config-ldap.c  |  4 +-
 src/modules/calendar/e-cal-attachment-handler.c    |  4 +-
 src/modules/calendar/e-cal-base-shell-backend.c    |  4 +-
 src/modules/calendar/e-cal-base-shell-sidebar.c    |  8 ++--
 src/modules/calendar/e-cal-shell-view-actions.c    |  4 +-
 src/modules/calendar/e-cal-shell-view-private.c    |  4 +-
 src/modules/composer-autosave/e-autosave-utils.c   |  4 +-
 src/modules/itip-formatter/itip-view.c             |  4 +-
 src/modules/mail/e-mail-attachment-handler.c       | 10 ++---
 src/modules/mail/e-mail-shell-backend.c            |  4 +-
 src/modules/mail/e-mail-shell-view-actions.c       |  4 +-
 src/modules/mail/e-mail-shell-view-private.c       |  4 +-
 src/plugins/bbdb/bbdb.c                            |  4 +-
 src/plugins/external-editor/external-editor.c      | 22 ++++++-----
 src/plugins/mail-to-task/mail-to-task.c            | 41 +++++++++++---------
 .../mailing-list-actions/mailing-list-actions.c    |  4 +-
 src/plugins/publish-calendar/publish-calendar.c    |  4 +-
 src/plugins/templates/templates.c                  |  4 +-
 src/shell/e-shell-taskbar.c                        |  6 +--
 src/shell/e-shell-window.c                         |  4 +-
 src/shell/e-shell.c                                |  6 +--
 src/smime/gui/certificate-manager.c                |  4 +-
 71 files changed, 306 insertions(+), 255 deletions(-)
---
diff --git a/src/addressbook/gui/contact-editor/e-contact-editor.c 
b/src/addressbook/gui/contact-editor/e-contact-editor.c
index bc0cd8466f..ab805d5fab 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -4399,6 +4399,16 @@ typedef struct {
        gchar *new_id;
 } EditorCloseStruct;
 
+static void
+editor_close_struct_free (EditorCloseStruct *ecs)
+{
+       if (ecs) {
+               g_clear_object (&ecs->ce);
+               g_free (ecs->new_id);
+               g_slice_free (EditorCloseStruct, ecs);
+       }
+}
+
 static void
 contact_removed_cb (GObject *source_object,
                     GAsyncResult *result,
@@ -4433,12 +4443,9 @@ contact_removed_cb (GObject *source_object,
                sensitize_all (ce);
        }
 
-       if (error != NULL)
-               g_error_free (error);
+       g_clear_error (&error);
 
-       g_object_unref (ce);
-       g_free (ecs->new_id);
-       g_free (ecs);
+       editor_close_struct_free (ecs);
 }
 
 static void
@@ -4477,8 +4484,7 @@ contact_added_cb (EBookClient *book_client,
                }
        }
 
-       g_object_unref (ce);
-       g_free (ecs);
+       editor_close_struct_free (ecs);
 }
 
 static void
@@ -4505,8 +4511,7 @@ contact_modified_cb (EBookClient *book_client,
                }
        }
 
-       g_object_unref (ce);
-       g_free (ecs);
+       editor_close_struct_free (ecs);
 }
 
 static void
@@ -4537,10 +4542,8 @@ real_save_contact (EContactEditor *ce,
        shell = eab_editor_get_shell (EAB_EDITOR (ce));
        registry = e_shell_get_registry (shell);
 
-       ecs = g_new0 (EditorCloseStruct, 1);
-       ecs->ce = ce;
-       g_object_ref (ecs->ce);
-
+       ecs = g_slice_new0 (EditorCloseStruct);
+       ecs->ce = g_object_ref (ce);
        ecs->should_close = should_close;
 
        gtk_widget_set_sensitive (ce->priv->app, FALSE);
diff --git a/src/addressbook/gui/contact-editor/e-contact-quick-add.c 
b/src/addressbook/gui/contact-editor/e-contact-quick-add.c
index f975083e60..33d521200a 100644
--- a/src/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/src/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -56,7 +56,7 @@ struct _QuickAdd {
 static QuickAdd *
 quick_add_new (EClientCache *client_cache)
 {
-       QuickAdd *qa = g_new0 (QuickAdd, 1);
+       QuickAdd *qa = g_slice_new0 (QuickAdd);
        qa->contact = e_contact_new ();
        qa->client_cache = g_object_ref (client_cache);
        qa->refs = 1;
@@ -78,7 +78,7 @@ quick_add_unref (QuickAdd *qa)
                        g_free (qa->vcard);
                        g_object_unref (qa->contact);
                        g_object_unref (qa->client_cache);
-                       g_free (qa);
+                       g_slice_free (QuickAdd, qa);
                }
        }
 }
diff --git a/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c 
b/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 42dafe0699..6ae264a947 100644
--- a/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -138,6 +138,15 @@ typedef struct {
 
 G_DEFINE_TYPE (EContactListEditor, e_contact_list_editor, EAB_TYPE_EDITOR)
 
+static void
+editor_close_struct_free (EditorCloseStruct *ecs)
+{
+       if (ecs) {
+               g_clear_object (&ecs->editor);
+               g_slice_free (EditorCloseStruct, ecs);
+       }
+}
+
 static void
 connect_closure_free (ConnectClosure *connect_closure)
 {
@@ -396,8 +405,7 @@ contact_list_editor_list_added_cb (EBookClient *book_client,
                        contact_list_editor_update (editor);
        }
 
-       g_object_unref (editor);
-       g_free (ecs);
+       editor_close_struct_free (ecs);
 }
 
 static void
@@ -421,8 +429,7 @@ contact_list_editor_list_modified_cb (EBookClient *book_client,
                        eab_editor_close (EAB_EDITOR (editor));
        }
 
-       g_object_unref (editor);
-       g_free (ecs);
+       editor_close_struct_free (ecs);
 }
 
 static void
@@ -1575,7 +1582,7 @@ contact_list_editor_save_contact (EABEditor *eab_editor,
 
        g_object_unref (active_source);
 
-       ecs = g_new (EditorCloseStruct, 1);
+       ecs = g_slice_new (EditorCloseStruct);
        ecs->editor = g_object_ref (editor);
        ecs->should_close = should_close;
 
diff --git a/src/addressbook/gui/widgets/e-addressbook-view.c 
b/src/addressbook/gui/widgets/e-addressbook-view.c
index d7c3101370..437831a9a5 100644
--- a/src/addressbook/gui/widgets/e-addressbook-view.c
+++ b/src/addressbook/gui/widgets/e-addressbook-view.c
@@ -1559,7 +1559,7 @@ all_contacts_ready_cb (GObject *source_object,
        }
 
        g_object_unref (tcd->view);
-       g_free (tcd);
+       g_slice_free (struct TransferContactsData, tcd);
 }
 
 static void
@@ -1584,7 +1584,7 @@ view_transfer_contacts (EAddressbookView *view,
                query_str = e_book_query_to_string (query);
                e_book_query_unref (query);
 
-               tcd = g_new0 (struct TransferContactsData, 1);
+               tcd = g_slice_new0 (struct TransferContactsData);
                tcd->delete_from_source = delete_from_source;
                tcd->view = g_object_ref (view);
 
diff --git a/src/addressbook/gui/widgets/eab-contact-compare.c 
b/src/addressbook/gui/widgets/eab-contact-compare.c
index c4ac180621..db0d9216bf 100644
--- a/src/addressbook/gui/widgets/eab-contact-compare.c
+++ b/src/addressbook/gui/widgets/eab-contact-compare.c
@@ -579,7 +579,7 @@ match_search_info_free (MatchSearchInfo *info)
                        info->avoid = NULL;
                }
 
-               g_free (info);
+               g_slice_free (MatchSearchInfo, info);
        }
 }
 
@@ -815,7 +815,7 @@ eab_contact_locate_match_full (ESourceRegistry *registry,
        g_return_if_fail (E_IS_CONTACT (contact));
        g_return_if_fail (cb != NULL);
 
-       info = g_new0 (MatchSearchInfo, 1);
+       info = g_slice_new0 (MatchSearchInfo);
        info->contact = g_object_ref (contact);
        info->cb = cb;
        info->closure = closure;
diff --git a/src/addressbook/gui/widgets/eab-contact-merging.c 
b/src/addressbook/gui/widgets/eab-contact-merging.c
index b5b48fc2f1..0919df0593 100644
--- a/src/addressbook/gui/widgets/eab-contact-merging.c
+++ b/src/addressbook/gui/widgets/eab-contact-merging.c
@@ -125,7 +125,7 @@ merge_dialog_data_free (MergeDialogData *mdd)
        g_list_free_full (mdd->contact_sip_attr_list, (GDestroyNotify) e_vcard_attribute_free);
        g_list_free (mdd->use_sip_attr_list);
 
-       g_free (mdd);
+       g_slice_free (MergeDialogData, mdd);
 }
 
 static void
@@ -166,6 +166,12 @@ finished_lookup (void)
        }
 }
 
+static EContactMergingLookup *
+new_lookup (void)
+{
+       return g_slice_new0 (EContactMergingLookup);
+}
+
 static void
 free_lookup (EContactMergingLookup *lookup)
 {
@@ -176,7 +182,7 @@ free_lookup (EContactMergingLookup *lookup)
        g_list_free (lookup->avoid);
        if (lookup->match)
                g_object_unref (lookup->match);
-       g_free (lookup);
+       g_slice_free (EContactMergingLookup, lookup);
 }
 
 static void
@@ -482,7 +488,7 @@ merge_dialog_data_create (EContactMergingLookup *lookup,
        gchar *string = NULL, *string1 = NULL;
        MergeDialogData *mdd;
 
-       mdd = g_new0 (MergeDialogData, 1);
+       mdd = g_slice_new0 (MergeDialogData);
        mdd->row = -1;
 
        mdd->dialog = gtk_dialog_new ();
@@ -991,7 +997,7 @@ eab_merging_book_add_contact (ESourceRegistry *registry,
 
        g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
 
-       lookup = g_new0 (EContactMergingLookup, 1);
+       lookup = new_lookup ();
 
        lookup->op = E_CONTACT_MERGING_ADD;
        lookup->registry = g_object_ref (registry);
@@ -1018,7 +1024,7 @@ eab_merging_book_modify_contact (ESourceRegistry *registry,
 
        g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
 
-       lookup = g_new0 (EContactMergingLookup, 1);
+       lookup = new_lookup ();
 
        lookup->op = E_CONTACT_MERGING_COMMIT;
        lookup->registry = g_object_ref (registry);
@@ -1043,7 +1049,7 @@ eab_merging_book_find_contact (ESourceRegistry *registry,
 {
        EContactMergingLookup *lookup;
 
-       lookup = g_new0 (EContactMergingLookup, 1);
+       lookup = new_lookup ();
 
        lookup->op = E_CONTACT_MERGING_FIND;
        lookup->registry = g_object_ref (registry);
diff --git a/src/addressbook/gui/widgets/eab-gui-util.c b/src/addressbook/gui/widgets/eab-gui-util.c
index 67360247ba..9abeaf92ba 100644
--- a/src/addressbook/gui/widgets/eab-gui-util.c
+++ b/src/addressbook/gui/widgets/eab-gui-util.c
@@ -480,7 +480,7 @@ process_unref (ContactCopyProcess *process)
                g_object_unref (process->source);
                g_object_unref (process->destination);
                g_object_unref (process->registry);
-               g_free (process);
+               g_slice_free (ContactCopyProcess, process);
        }
 }
 
@@ -605,7 +605,7 @@ eab_transfer_contacts (ESourceRegistry *registry,
                last_uid = g_strdup (e_source_get_uid (destination));
        }
 
-       process = g_new (ContactCopyProcess, 1);
+       process = g_slice_new0 (ContactCopyProcess);
        process->count = 1;
        process->book_status = FALSE;
        process->source = g_object_ref (source_client);
diff --git a/src/calendar/gui/e-cal-data-model.c b/src/calendar/gui/e-cal-data-model.c
index 08b0d040e7..e2311f8dd4 100644
--- a/src/calendar/gui/e-cal-data-model.c
+++ b/src/calendar/gui/e-cal-data-model.c
@@ -337,7 +337,7 @@ view_state_changed_data_free (gpointer ptr)
                g_clear_object (&vscd->view);
                g_clear_error (&vscd->error);
                g_free (vscd->message);
-               g_free (vscd);
+               g_slice_free (ViewStateChangedData, vscd);
        }
 }
 
@@ -372,7 +372,7 @@ cal_data_model_emit_view_state_changed (ECalDataModel *data_model,
        if (e_cal_data_model_get_disposing (data_model))
                return;
 
-       vscd = g_new0 (ViewStateChangedData, 1);
+       vscd = g_slice_new0 (ViewStateChangedData);
        vscd->data_model = g_object_ref (data_model);
        vscd->view = g_object_ref (view);
        vscd->state = state;
@@ -405,7 +405,7 @@ cal_data_model_internal_thread_job_func (gpointer data,
        job_data->func (job_data->data_model, job_data->user_data);
 
        g_object_unref (job_data->data_model);
-       g_free (job_data);
+       g_slice_free (InternalThreadJobData, job_data);
 }
 
 static void
@@ -418,7 +418,7 @@ cal_data_model_submit_internal_thread_job (ECalDataModel *data_model,
        g_return_if_fail (E_IS_CAL_DATA_MODEL (data_model));
        g_return_if_fail (func != NULL);
 
-       job_data = g_new0 (InternalThreadJobData, 1);
+       job_data = g_slice_new0 (InternalThreadJobData);
        job_data->data_model = g_object_ref (data_model);
        job_data->func = func;
        job_data->user_data = user_data;
@@ -1080,7 +1080,7 @@ cal_data_model_notify_recurrences_cb (gpointer user_data)
 
        g_clear_object (&notif_data->client);
        g_clear_object (&notif_data->data_model);
-       g_free (notif_data);
+       g_slice_free (NotifyRecurrencesData, notif_data);
 
        return FALSE;
 }
@@ -1232,7 +1232,7 @@ cal_data_model_expand_recurrences_thread (ECalDataModel *data_model,
        if (view_data->is_used) {
                NotifyRecurrencesData *notif_data;
 
-               notif_data = g_new0 (NotifyRecurrencesData, 1);
+               notif_data = g_slice_new0 (NotifyRecurrencesData);
                notif_data->data_model = g_object_ref (data_model);
                notif_data->client = g_object_ref (client);
 
@@ -1561,7 +1561,7 @@ create_view_data_free (gpointer ptr)
        if (cv_data) {
                g_clear_object (&cv_data->data_model);
                g_clear_object (&cv_data->client);
-               g_free (cv_data);
+               g_slice_free (CreateViewData, cv_data);
        }
 }
 
@@ -1766,7 +1766,7 @@ cal_data_model_update_client_view (ECalDataModel *data_model,
                        return;
        }
 
-       cv_data = g_new0 (CreateViewData, 1);
+       cv_data = g_slice_new0 (CreateViewData);
        cv_data->data_model = g_object_ref (data_model);
        cv_data->client = g_object_ref (client);
 
diff --git a/src/calendar/gui/e-cal-dialogs.c b/src/calendar/gui/e-cal-dialogs.c
index d084ec86d0..63a4dd57c9 100644
--- a/src/calendar/gui/e-cal-dialogs.c
+++ b/src/calendar/gui/e-cal-dialogs.c
@@ -141,7 +141,7 @@ copy_source_data_free (gpointer ptr)
                g_clear_object (&csd->from_source);
                g_clear_object (&csd->to_source);
                g_clear_object (&csd->to_client);
-               g_free (csd);
+               g_slice_free (CopySourceData, csd);
        }
 }
 
@@ -322,7 +322,7 @@ e_cal_dialogs_copy_source (GtkWindow *parent,
                gchar *display_name;
                gchar *description;
 
-               csd = g_new0 (CopySourceData, 1);
+               csd = g_slice_new0 (CopySourceData);
                csd->model = g_object_ref (model);
                csd->from_source = g_object_ref (from_source);
                csd->to_source = g_object_ref (to_source);
diff --git a/src/calendar/gui/e-cal-model.c b/src/calendar/gui/e-cal-model.c
index a3e10069c7..1e3ef7e3a3 100644
--- a/src/calendar/gui/e-cal-model.c
+++ b/src/calendar/gui/e-cal-model.c
@@ -1334,7 +1334,7 @@ create_component_data_free (gpointer ptr)
                g_clear_object (&ccd->model);
                g_clear_object (&ccd->table_model);
                g_hash_table_destroy (ccd->values);
-               g_free (ccd);
+               g_slice_free (CreateComponentData, ccd);
        }
 }
 
@@ -1508,7 +1508,7 @@ cal_model_append_row (ETableModel *etm,
                model_class->store_values_from_model (model, source, row, values);
        }
 
-       ccd = g_new0 (CreateComponentData, 1);
+       ccd = g_slice_new0 (CreateComponentData);
        ccd->model = g_object_ref (model);
        ccd->table_model = g_object_ref (source);
        ccd->values = values;
diff --git a/src/calendar/gui/e-cal-ops.c b/src/calendar/gui/e-cal-ops.c
index 7afc052d14..d735b24ca1 100644
--- a/src/calendar/gui/e-cal-ops.c
+++ b/src/calendar/gui/e-cal-ops.c
@@ -97,6 +97,12 @@ typedef struct {
        gboolean success;
 } BasicOperationData;
 
+static BasicOperationData *
+basic_operation_data_new (void)
+{
+       return g_slice_new0 (BasicOperationData);
+}
+
 static void
 basic_operation_data_free (gpointer ptr)
 {
@@ -127,7 +133,7 @@ basic_operation_data_free (gpointer ptr)
                g_free (bod->for_client_uid);
                g_free (bod->uid);
                g_free (bod->rid);
-               g_free (bod);
+               g_slice_free (BasicOperationData, bod);
        }
 }
 
@@ -201,7 +207,7 @@ e_cal_ops_create_component (ECalModel *model,
        data_model = e_cal_model_get_data_model (model);
        source = e_client_get_source (E_CLIENT (client));
 
-       bod = g_new0 (BasicOperationData, 1);
+       bod = basic_operation_data_new ();
        bod->model = g_object_ref (model);
        bod->client = g_object_ref (client);
        bod->icomp = i_cal_component_clone (icomp);
@@ -321,7 +327,7 @@ e_cal_ops_modify_component (ECalModel *model,
        data_model = e_cal_model_get_data_model (model);
        source = e_client_get_source (E_CLIENT (client));
 
-       bod = g_new0 (BasicOperationData, 1);
+       bod = basic_operation_data_new ();
        bod->model = g_object_ref (model);
        bod->client = g_object_ref (client);
        bod->icomp = i_cal_component_clone (icomp);
@@ -427,7 +433,7 @@ e_cal_ops_remove_component (ECalModel *model,
        data_model = e_cal_model_get_data_model (model);
        source = e_client_get_source (E_CLIENT (client));
 
-       bod = g_new0 (BasicOperationData, 1);
+       bod = basic_operation_data_new ();
        bod->model = g_object_ref (model);
        bod->client = g_object_ref (client);
        bod->uid = g_strdup (uid);
@@ -574,7 +580,7 @@ paste_components_data_free (gpointer ptr)
 
                g_clear_object (&pcd->model);
                g_clear_object (&pcd->icomp);
-               g_free (pcd);
+               g_slice_free (PasteComponentsData, pcd);
        }
 }
 
@@ -762,7 +768,7 @@ e_cal_ops_paste_components (ECalModel *model,
                return;
        }
 
-       pcd = g_new0 (PasteComponentsData, 1);
+       pcd = g_slice_new0 (PasteComponentsData);
        pcd->model = g_object_ref (model);
        pcd->icomp = icomp;
        pcd->kind = kind;
@@ -791,7 +797,7 @@ send_component_data_free (gpointer ptr)
        if (scd) {
                g_clear_object (&scd->client);
                g_clear_object (&scd->icomp);
-               g_free (scd);
+               g_slice_free (SendComponentData, scd);
        }
 }
 
@@ -860,7 +866,7 @@ e_cal_ops_send_component (ECalModel *model,
                        return;
        }
 
-       scd = g_new0 (SendComponentData, 1);
+       scd = g_slice_new0 (SendComponentData);
        scd->client = g_object_ref (client);
        scd->icomp = i_cal_component_clone (icomp);
 
@@ -891,7 +897,7 @@ purge_components_data_free (gpointer ptr)
        if (pcd) {
                g_clear_object (&pcd->model);
                g_list_free_full (pcd->clients, g_object_unref);
-               g_free (pcd);
+               g_slice_free (PurgeComponentsData, pcd);
        }
 }
 
@@ -1120,7 +1126,7 @@ e_cal_ops_purge_components (ECalModel *model,
 
        data_model = e_cal_model_get_data_model (model);
 
-       pcd = g_new0 (PurgeComponentsData, 1);
+       pcd = g_slice_new0 (PurgeComponentsData);
        pcd->model = g_object_ref (model);
        pcd->clients = e_cal_data_model_get_clients (data_model);
        pcd->kind = e_cal_model_get_component_kind (model);
@@ -1386,7 +1392,7 @@ e_cal_ops_get_default_component (ECalModel *model,
                        display_name = e_util_get_source_full_name (registry, source);
        }
 
-       bod = g_new0 (BasicOperationData, 1);
+       bod = basic_operation_data_new ();
        bod->model = g_object_ref (model);
        bod->client = NULL;
        bod->icomp = NULL;
@@ -1437,6 +1443,12 @@ typedef struct
        EDurationType default_reminder_units;
 } NewComponentData;
 
+static NewComponentData *
+new_component_data_new (void)
+{
+       return g_slice_new0 (NewComponentData);
+}
+
 static void
 new_component_data_free (gpointer ptr)
 {
@@ -1527,7 +1539,7 @@ new_component_data_free (gpointer ptr)
                g_clear_object (&ncd->comp);
                g_free (ncd->extension_name);
                g_free (ncd->for_client_uid);
-               g_free (ncd);
+               g_slice_free (NewComponentData, ncd);
        }
 }
 
@@ -1656,7 +1668,7 @@ e_cal_ops_new_component_ex (EShellWindow *shell_window,
        if (for_client_uid)
                for_client_source = e_source_registry_ref_source (registry, for_client_uid);
 
-       ncd = g_new0 (NewComponentData, 1);
+       ncd = new_component_data_new ();
        ncd->is_new_component = TRUE;
        ncd->shell = g_object_ref (shell);
        ncd->model = model ? g_object_ref (model) : NULL;
@@ -1865,7 +1877,7 @@ e_cal_ops_open_component_in_editor_sync (ECalModel *model,
        comp = e_cal_component_new_from_icalcomponent (i_cal_component_clone (icomp));
        g_return_if_fail (comp != NULL);
 
-       ncd = g_new0 (NewComponentData, 1);
+       ncd = new_component_data_new ();
        ncd->is_new_component = FALSE;
        ncd->shell = g_object_ref (model ? e_cal_model_get_shell (model) : e_shell_get_default ());
        ncd->model = model ? g_object_ref (model) : NULL;
@@ -1914,7 +1926,7 @@ transfer_components_data_free (gpointer ptr)
                g_clear_object (&tcd->destination);
                g_clear_object (&tcd->destination_client);
                g_hash_table_destroy (tcd->icomps_by_source);
-               g_free (tcd);
+               g_slice_free (TransferComponentsData, tcd);
        }
 }
 
@@ -2078,7 +2090,7 @@ e_cal_ops_transfer_components (EShellView *shell_view,
                        return;
        }
 
-       tcd = g_new0 (TransferComponentsData, 1);
+       tcd = g_slice_new0 (TransferComponentsData);
        tcd->shell = g_object_ref (e_shell_window_get_shell (e_shell_view_get_shell_window (shell_view)));
        tcd->model = g_object_ref (model);
        tcd->icomps_by_source = g_hash_table_new_full ((GHashFunc) e_source_hash, (GEqualFunc) e_source_equal,
diff --git a/src/calendar/gui/e-calendar-view.c b/src/calendar/gui/e-calendar-view.c
index 7d91fdcfcb..cc182884f6 100644
--- a/src/calendar/gui/e-calendar-view.c
+++ b/src/calendar/gui/e-calendar-view.c
@@ -871,7 +871,7 @@ paste_clipboard_data_free (gpointer ptr)
                g_slist_free_full (pcd->selected_cut_list, g_object_unref);
                g_slist_free_full (pcd->copied_uids, g_free);
                g_free (pcd->ical_str);
-               g_free (pcd);
+               g_slice_free (PasteClipboardData, pcd);
        }
 }
 
@@ -1068,7 +1068,7 @@ calendar_view_paste_clipboard (ESelectable *selectable)
                                return;
                }
 
-               pcd = g_new0 (PasteClipboardData, 1);
+               pcd = g_slice_new0 (PasteClipboardData);
                pcd->cal_view = g_object_ref (cal_view);
                pcd->selected_cut_list = cal_view->priv->selected_cut_list;
                cal_view->priv->selected_cut_list = NULL;
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index f4c27fde34..4156f479ed 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -351,7 +351,7 @@ save_data_free (SaveData *sd)
                g_slist_free_full (sd->mime_attach_list, itip_cal_mime_attach_free);
                g_free (sd->alert_ident);
                g_free (sd->alert_arg_0);
-               g_free (sd);
+               g_slice_free (SaveData, sd);
        }
 }
 
@@ -966,7 +966,7 @@ ece_save_component (ECompEditor *comp_editor,
 
        e_comp_editor_enable (comp_editor, FALSE);
 
-       sd = g_new0 (SaveData, 1);
+       sd = g_slice_new0 (SaveData);
        sd->comp_editor = g_object_ref (comp_editor);
        sd->source_client = comp_editor->priv->source_client ? g_object_ref 
(comp_editor->priv->source_client) : NULL;
        sd->target_client = g_object_ref (comp_editor->priv->target_client);
@@ -1051,7 +1051,7 @@ open_target_client_data_free (gpointer ptr)
                g_free (otc->extension_name);
                g_free (otc->cal_email_address);
                g_free (otc->alarm_email_address);
-               g_free (otc);
+               g_slice_free (OpenTargetClientData, otc);
        }
 }
 
@@ -1117,7 +1117,7 @@ update_activity_bar_data_free (gpointer ptr)
        if (uab) {
                g_clear_object (&uab->comp_editor);
                g_clear_object (&uab->activity);
-               g_free (uab);
+               g_slice_free (UpdateActivityBarData, uab);
        }
 }
 
@@ -1182,7 +1182,7 @@ e_comp_editor_open_target_client (ECompEditor *comp_editor)
        credentials_prompter = e_shell_get_credentials_prompter (e_comp_editor_get_shell (comp_editor));
        e_credentials_prompter_set_auto_prompt_disabled_for (credentials_prompter, source, FALSE);
 
-       otc = g_new0 (OpenTargetClientData, 1);
+       otc = g_slice_new0 (OpenTargetClientData);
        otc->extension_name = g_strdup (extension_name);
        otc->comp_editor = g_object_ref (comp_editor);
        otc->source = g_object_ref (source);
@@ -1204,7 +1204,7 @@ e_comp_editor_open_target_client (ECompEditor *comp_editor)
        if (comp_editor->priv->activity_bar) {
                UpdateActivityBarData *uab;
 
-               uab = g_new0 (UpdateActivityBarData, 1);
+               uab = g_slice_new0 (UpdateActivityBarData);
                uab->comp_editor = g_object_ref (comp_editor);
                uab->activity = g_object_ref (activity);
 
diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c
index a628864c2b..1fd1dd9890 100644
--- a/src/calendar/gui/e-day-view.c
+++ b/src/calendar/gui/e-day-view.c
@@ -744,8 +744,8 @@ new_event_in_rage_data_free (gpointer ptr)
 
        if (ned) {
                g_clear_object (&ned->day_view);
-               g_free (ned->key_event);
-               g_free (ned);
+               g_slice_free (GdkEventKey, ned->key_event);
+               g_slice_free (NewEventInRangeData, ned);
        }
 }
 
@@ -863,10 +863,10 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view,
        ECalModel *model;
        const gchar *source_uid;
 
-       ned = g_new0 (NewEventInRangeData, 1);
+       ned = g_slice_new0 (NewEventInRangeData);
        ned->day_view = g_object_ref (day_view);
        if (key_event) {
-               ned->key_event = g_new0 (GdkEventKey, 1);
+               ned->key_event = g_slice_new0 (GdkEventKey);
                *ned->key_event = *key_event;
        }
        day_view_get_selected_time_range (E_CALENDAR_VIEW (day_view), &ned->dtstart, &ned->dtend);
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index e6141be27b..4681de06c0 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -2024,7 +2024,7 @@ remove_operation_data_free (gpointer ptr)
                g_clear_object (&rod->client);
                g_free (rod->uid);
                g_free (rod->rid);
-               g_free (rod);
+               g_slice_free (RemoveOperationData, rod);
        }
 }
 
@@ -2090,7 +2090,7 @@ etdp_delete_common (EToDoPane *to_do_pane,
                if (!e_cal_component_is_instance (comp))
                        mod = E_CAL_OBJ_MOD_ALL;
 
-               rod = g_new0 (RemoveOperationData,1);
+               rod = g_slice_new0 (RemoveOperationData);
                rod->client = g_object_ref (client);
                rod->uid = g_strdup (e_cal_component_id_get_uid (id));
                rod->rid = g_strdup (e_cal_component_id_get_rid (id));
diff --git a/src/calendar/gui/e-week-view.c b/src/calendar/gui/e-week-view.c
index ea424c39ee..f4b12f07c3 100644
--- a/src/calendar/gui/e-week-view.c
+++ b/src/calendar/gui/e-week-view.c
@@ -634,7 +634,7 @@ new_event_in_rage_data_free (gpointer ptr)
        if (ned) {
                g_clear_object (&ned->week_view);
                g_free (ned->initial_text);
-               g_free (ned);
+               g_slice_free (NewEventInRangeData, ned);
        }
 }
 
@@ -739,7 +739,7 @@ e_week_view_add_new_event_in_selected_range (EWeekView *week_view,
        ECalModel *model;
        const gchar *source_uid;
 
-       ned = g_new0 (NewEventInRangeData, 1);
+       ned = g_slice_new0 (NewEventInRangeData);
        ned->week_view = g_object_ref (week_view);
        ned->initial_text = g_strdup (initial_text);
        ned->dtstart = week_view->day_starts[week_view->selection_start_day];
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index cba4c2e499..feb300d9ab 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -2030,7 +2030,7 @@ itip_send_component_data_free (gpointer ptr)
                g_clear_error (&isc->async_error);
                g_slist_free_full (isc->attachments_list, itip_cal_mime_attach_free); /* CamelMimePart */
                g_slist_free_full (isc->users, g_free);
-               g_free (isc);
+               g_slice_free (ItipSendComponentData, isc);
        }
 }
 
@@ -2117,7 +2117,7 @@ itip_send_component_composer_created_cb (GObject *source_object,
        if (error) {
                g_warning ("%s: Failed to create msg composer: %s", G_STRFUNC, error->message);
                g_clear_error (&error);
-               return;
+               goto free_ccd;
        }
 
        settings = e_util_ref_settings ("org.gnome.evolution.calendar");
@@ -2173,6 +2173,7 @@ itip_send_component_composer_created_cb (GObject *source_object,
        else
                e_msg_composer_send (composer);
 
+ free_ccd:
        e_destination_freev (ccd->destinations);
        g_slist_free_full (ccd->send_comps, g_object_unref);
        g_free (ccd->identity_uid);
@@ -2182,7 +2183,7 @@ itip_send_component_composer_created_cb (GObject *source_object,
        g_free (ccd->ical_string);
        g_free (ccd->content_type);
        g_free (ccd->event_body_text);
-       g_free (ccd);
+       g_slice_free (CreateComposerData, ccd);
 }
 
 static void
@@ -2234,7 +2235,7 @@ itip_send_component_complete (ItipSendComponentData *isc)
 
        top_level = comp_toplevel_with_zones (isc->method, isc->send_comps, isc->cal_client, isc->zones);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->identity_uid = identity_uid;
        ccd->identity_name = identity_name;
        ccd->identity_address = identity_address;
@@ -2328,7 +2329,7 @@ itip_send_component_with_model (ECalModel *model,
        data_model = e_cal_model_get_data_model (model);
        source = e_client_get_source (E_CLIENT (cal_client));
 
-       isc = g_new0 (ItipSendComponentData, 1);
+       isc = g_slice_new0 (ItipSendComponentData);
        isc->registry = g_object_ref (registry);
        isc->method = method;
        isc->send_comps = g_slist_prepend (NULL, g_object_ref (send_comp));
@@ -2430,7 +2431,7 @@ itip_send_component (ESourceRegistry *registry,
        GTask *task;
        ItipSendComponentData *isc;
 
-       isc = g_new0 (ItipSendComponentData, 1);
+       isc = g_slice_new0 (ItipSendComponentData);
        isc->registry = g_object_ref (registry);
        isc->method = method;
        isc->send_comps = g_slist_prepend (NULL, g_object_ref (send_comp));
@@ -2519,7 +2520,7 @@ reply_to_calendar_comp (ESourceRegistry *registry,
 
        top_level = comp_toplevel_with_zones (method, ecomps, cal_client, zones);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->identity_uid = identity_uid;
        ccd->identity_name = identity_name;
        ccd->identity_address = identity_address;
diff --git a/src/calendar/gui/tag-calendar.c b/src/calendar/gui/tag-calendar.c
index 3dad09dd81..eea5ccc718 100644
--- a/src/calendar/gui/tag-calendar.c
+++ b/src/calendar/gui/tag-calendar.c
@@ -130,7 +130,7 @@ object_info_new (ECalClient *client,
        g_return_val_if_fail (client != NULL, NULL);
        g_return_val_if_fail (id != NULL, NULL);
 
-       oinfo = g_new0 (ObjectInfo, 1);
+       oinfo = g_slice_new0 (ObjectInfo);
        oinfo->client = client;
        oinfo->id = id;
        oinfo->is_transparent = is_transparent;
@@ -148,14 +148,14 @@ object_info_free (gpointer ptr)
 
        if (oinfo) {
                e_cal_component_id_free (oinfo->id);
-               g_free (oinfo);
+               g_slice_free (ObjectInfo, oinfo);
        }
 }
 
 static DateInfo *
 date_info_new (void)
 {
-       return g_new0 (DateInfo, 1);
+       return g_slice_new0 (DateInfo);
 }
 
 static void
@@ -164,7 +164,7 @@ date_info_free (gpointer ptr)
        DateInfo *dinfo = ptr;
 
        if (dinfo)
-               g_free (dinfo);
+               g_slice_free (DateInfo, dinfo);
 }
 
 static gboolean
@@ -888,6 +888,15 @@ struct calendar_tag_closure {
        gboolean recur_events_italic;
 };
 
+static void
+calendar_tag_closure_free (gpointer ptr)
+{
+       struct calendar_tag_closure *closure = ptr;
+
+       if (closure)
+               g_slice_free (struct calendar_tag_closure, closure);
+}
+
 /* Clears all the tags in a calendar and fills a closure structure with the
  * necessary information for iterating over occurrences.  Returns FALSE if
  * the calendar has no dates shown.  */
@@ -1040,7 +1049,7 @@ tag_calendar_by_comp (ECalendar *ecal,
        if (comp_is_on_server) {
                struct calendar_tag_closure *alloced_closure;
 
-               alloced_closure = g_new0 (struct calendar_tag_closure, 1);
+               alloced_closure = g_slice_new0 (struct calendar_tag_closure);
 
                *alloced_closure = closure;
 
@@ -1048,7 +1057,7 @@ tag_calendar_by_comp (ECalendar *ecal,
                        client, e_cal_component_get_icalcomponent (comp),
                        closure.start_time, closure.end_time, cancellable,
                        tag_calendar_cb,
-                       alloced_closure, (GDestroyNotify) g_free);
+                       alloced_closure, calendar_tag_closure_free);
        } else {
                ICalTime *start, *end;
 
diff --git a/src/calendar/importers/icalendar-importer.c b/src/calendar/importers/icalendar-importer.c
index 4c36d6140e..ef048f2258 100644
--- a/src/calendar/importers/icalendar-importer.c
+++ b/src/calendar/importers/icalendar-importer.c
@@ -929,7 +929,7 @@ default_client_connect_cb (GObject *source_object,
        if (error != NULL)
                g_error_free (error);
 
-       g_free (odsd);
+       g_slice_free (struct OpenDefaultSourceData, odsd);
 }
 
 static void
@@ -964,7 +964,7 @@ open_default_source (ICalIntelligentImporter *ici,
                        g_return_if_reached ();
        }
 
-       odsd = g_new0 (struct OpenDefaultSourceData, 1);
+       odsd = g_slice_new0 (struct OpenDefaultSourceData);
        odsd->ici = ici;
        odsd->opened_cb = opened_cb;
 
diff --git a/src/e-util/e-activity-bar.c b/src/e-util/e-activity-bar.c
index 0d148715bf..e3cf5c9134 100644
--- a/src/e-util/e-activity-bar.c
+++ b/src/e-util/e-activity-bar.c
@@ -68,7 +68,7 @@ activity_bar_timeout_data_free (gpointer ptr)
 
        if (data) {
                g_object_unref (data->activity);
-               g_free (data);
+               g_slice_free (EActivityBarTimeoutData, data);
        }
 }
 
@@ -104,7 +104,7 @@ activity_bar_feedback (EActivityBar *bar)
        if (bar->priv->timeout_id > 0)
                g_source_remove (bar->priv->timeout_id);
 
-       data = g_new0 (EActivityBarTimeoutData, 1);
+       data = g_slice_new0 (EActivityBarTimeoutData);
 
        data->bar = bar;
        data->activity = g_object_ref (activity);
diff --git a/src/e-util/e-activity-proxy.c b/src/e-util/e-activity-proxy.c
index 347b70d9c0..027666e021 100644
--- a/src/e-util/e-activity-proxy.c
+++ b/src/e-util/e-activity-proxy.c
@@ -72,7 +72,7 @@ unset_timeout_data_free (gpointer ptr)
 
        if (utd) {
                g_object_unref (utd->activity);
-               g_free (utd);
+               g_slice_free (UnsetTimeoutData, utd);
        }
 }
 
@@ -111,7 +111,7 @@ activity_proxy_feedback (EActivityProxy *proxy)
        if (proxy->priv->timeout_id > 0)
                g_source_remove (proxy->priv->timeout_id);
 
-       utd = g_new0 (UnsetTimeoutData, 1);
+       utd = g_slice_new0 (UnsetTimeoutData);
        utd->proxy = proxy;
        /* Hold a reference on the EActivity for a short
         * period so the activity proxy stays visible. */
diff --git a/src/e-util/e-alert-sink.c b/src/e-util/e-alert-sink.c
index 9a826fab3d..255770c5e6 100644
--- a/src/e-util/e-alert-sink.c
+++ b/src/e-util/e-alert-sink.c
@@ -146,7 +146,7 @@ e_alert_sink_thread_job_done_cb (gpointer user_data)
        if (job_data->free_user_data)
                job_data->free_user_data (job_data->user_data);
 
-       g_free (job_data);
+       g_slice_free (EAlertSinkThreadJobData, job_data);
 
        return FALSE;
 }
@@ -225,7 +225,7 @@ e_alert_sink_submit_thread_job (EAlertSink *alert_sink,
 
        camel_operation_push_message (cancellable, "%s", description);
 
-       job_data = g_new0 (EAlertSinkThreadJobData, 1);
+       job_data = g_slice_new0 (EAlertSinkThreadJobData);
        job_data->activity = g_object_ref (activity);
        job_data->alert_ident = g_strdup (alert_ident);
        job_data->alert_arg_0 = g_strdup (alert_arg_0);
diff --git a/src/e-util/e-collection-account-wizard.c b/src/e-util/e-collection-account-wizard.c
index 62a1790f7c..3a30d2fbbc 100644
--- a/src/e-util/e-collection-account-wizard.c
+++ b/src/e-util/e-collection-account-wizard.c
@@ -582,7 +582,7 @@ password_prompt_data_new (ECollectionAccountWizard *wizard,
 {
        PasswordPromptData *ppd;
 
-       ppd = g_new0 (PasswordPromptData, 1);
+       ppd = g_slice_new0 (PasswordPromptData);
        ppd->wizard = wizard;
        ppd->worker = worker;
        ppd->popover = popover;
@@ -600,7 +600,7 @@ password_prompt_data_free (gpointer data,
 
        if (ppd) {
                /* Nothing to free inside the structure */
-               g_free (ppd);
+               g_slice_free (PasswordPromptData, ppd);
        }
 }
 
diff --git a/src/e-util/e-config-lookup-result-simple.c b/src/e-util/e-config-lookup-result-simple.c
index 5cd16baa0b..29e1e5015a 100644
--- a/src/e-util/e-config-lookup-result-simple.c
+++ b/src/e-util/e-config-lookup-result-simple.c
@@ -80,7 +80,7 @@ value_data_new (const gchar *extension_name,
 {
        ValueData *vd;
 
-       vd = g_new0 (ValueData, 1);
+       vd = g_slice_new0 (ValueData);
        vd->extension_name = g_strdup (extension_name);
        vd->property_name = g_strdup (property_name);
 
@@ -99,7 +99,7 @@ value_data_free (gpointer ptr)
                g_free (vd->extension_name);
                g_free (vd->property_name);
                g_value_reset (&vd->value);
-               g_free (vd);
+               g_slice_free (ValueData, vd);
        }
 }
 
diff --git a/src/e-util/e-config-lookup.c b/src/e-util/e-config-lookup.c
index a16225f9bf..b9dc1283b1 100644
--- a/src/e-util/e-config-lookup.c
+++ b/src/e-util/e-config-lookup.c
@@ -98,7 +98,7 @@ emit_data_free (gpointer ptr)
                g_clear_object (&ed->worker);
                g_clear_object (&ed->cancellable);
                g_clear_error (&ed->error);
-               g_free (ed);
+               g_slice_free (EmitData, ed);
        }
 }
 
@@ -136,7 +136,7 @@ config_lookup_schedule_emit_idle (EConfigLookup *config_lookup,
        if (worker)
                g_return_if_fail (E_IS_CONFIG_LOOKUP_WORKER (worker));
 
-       ed = g_new0 (EmitData, 1);
+       ed = g_slice_new0 (EmitData);
        ed->config_lookup = g_object_ref (config_lookup);
        ed->flags = emit_flags;
        ed->worker = worker ? g_object_ref (worker) : NULL;
@@ -204,7 +204,7 @@ config_lookup_thread (gpointer data,
        g_clear_object (&td->worker);
        g_clear_object (&td->cancellable);
        g_clear_error (&error);
-       g_free (td);
+       g_slice_free (ThreadData, td);
 }
 
 static void
@@ -803,7 +803,7 @@ e_config_lookup_run_worker (EConfigLookup *config_lookup,
        g_return_if_fail (E_IS_CONFIG_LOOKUP_WORKER (worker));
        g_return_if_fail (params != NULL);
 
-       td = g_new0 (ThreadData, 1);
+       td = g_slice_new0 (ThreadData);
        td->params = e_named_parameters_new_clone (params);
        td->worker = g_object_ref (worker);
 
diff --git a/src/e-util/e-content-request.c b/src/e-util/e-content-request.c
index 9be6e09ad8..bc026f3892 100644
--- a/src/e-util/e-content-request.c
+++ b/src/e-util/e-content-request.c
@@ -106,7 +106,7 @@ thread_data_free (gpointer ptr)
                g_free (td->uri);
                g_free (td->out_mime_type);
                g_clear_error (&td->error);
-               g_free (td);
+               g_slice_free (ThreadData, td);
        }
 }
 
@@ -147,7 +147,7 @@ e_content_request_process (EContentRequest *request,
        is_http = g_ascii_strncasecmp (uri, "http", 4) == 0 ||
                  g_ascii_strncasecmp (uri, "evo-http", 8) == 0;
 
-       td = g_new0 (ThreadData, 1);
+       td = g_slice_new0 (ThreadData);
        td->uri = g_strdup (uri);
        td->requester = g_object_ref (requester);
 
diff --git a/src/e-util/e-html-editor.c b/src/e-util/e-html-editor.c
index e4a7538ac9..59ab93e472 100644
--- a/src/e-util/e-html-editor.c
+++ b/src/e-util/e-html-editor.c
@@ -504,7 +504,7 @@ context_menu_data_free (gpointer ptr)
        if (cmd) {
                g_clear_pointer (&cmd->event, gdk_event_free);
                e_weak_ref_free (cmd->editor_weakref);
-               g_free (cmd);
+               g_slice_free (ContextMenuData, cmd);
        }
 }
 
@@ -560,7 +560,7 @@ html_editor_context_menu_requested_cb (EContentEditor *cnt_editor,
 
        g_return_val_if_fail (E_IS_HTML_EDITOR (editor), FALSE);
 
-       cmd = g_new0 (ContextMenuData, 1);
+       cmd = g_slice_new0 (ContextMenuData);
        cmd->editor_weakref = e_weak_ref_new (editor);
        cmd->flags = flags;
        cmd->event = gdk_event_copy (event);
diff --git a/src/e-util/e-import-assistant.c b/src/e-util/e-import-assistant.c
index 53b88aa3df..f3f605fc42 100644
--- a/src/e-util/e-import-assistant.c
+++ b/src/e-util/e-import-assistant.c
@@ -785,7 +785,7 @@ run_import_progress_page_idle (gpointer user_data)
                import_assistant_finished (pd->assistant, NULL);
 
        g_object_unref (pd->assistant);
-       g_free (pd);
+       g_slice_free (ProgressData, pd);
 
        return FALSE;
 }
@@ -842,7 +842,7 @@ prepare_progress_page (GtkAssistant *assistant,
                }
        }
 
-       pd = g_new0 (ProgressData, 1);
+       pd = g_slice_new0 (ProgressData);
        pd->assistant = g_object_ref (assistant);
        pd->done = done;
 
diff --git a/src/e-util/e-mail-signature-editor.c b/src/e-util/e-mail-signature-editor.c
index 4b6c13fae3..2ba2955ded 100644
--- a/src/e-util/e-mail-signature-editor.c
+++ b/src/e-util/e-mail-signature-editor.c
@@ -722,7 +722,7 @@ create_editor_data_free (gpointer ptr)
        if (ced) {
                g_clear_object (&ced->registry);
                g_clear_object (&ced->source);
-               g_free (ced);
+               g_slice_free (CreateEditorData, ced);
        }
 }
 
@@ -804,7 +804,7 @@ e_mail_signature_editor_new (ESourceRegistry *registry,
        if (source != NULL)
                g_return_if_fail (E_IS_SOURCE (source));
 
-       ced = g_new0 (CreateEditorData, 1);
+       ced = g_slice_new0 (CreateEditorData);
        ced->registry = g_object_ref (registry);
        ced->source = source ? g_object_ref (source) : NULL;
 
diff --git a/src/e-util/e-misc-utils.c b/src/e-util/e-misc-utils.c
index 3b3f27e016..9639784dbf 100644
--- a/src/e-util/e-misc-utils.c
+++ b/src/e-util/e-misc-utils.c
@@ -3397,7 +3397,7 @@ e_util_simple_async_result_thread (gpointer data,
 
        g_clear_object (&thread_data->simple);
        g_clear_object (&thread_data->cancellable);
-       g_free (thread_data);
+       g_slice_free (EUtilSimpleAsyncResultThreadData, thread_data);
 }
 
 /**
@@ -3432,7 +3432,7 @@ e_util_run_simple_async_result_in_thread (GSimpleAsyncResult *simple,
        if (!thread_pool)
                thread_pool = g_thread_pool_new (e_util_simple_async_result_thread, NULL, 20, FALSE, NULL);
 
-       thread_data = g_new0 (EUtilSimpleAsyncResultThreadData, 1);
+       thread_data = g_slice_new0 (EUtilSimpleAsyncResultThreadData);
        thread_data->simple = g_object_ref (simple);
        thread_data->func = func;
        thread_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
diff --git a/src/e-util/e-name-selector-list.c b/src/e-util/e-name-selector-list.c
index 53ffb12e06..4396225d04 100644
--- a/src/e-util/e-name-selector-list.c
+++ b/src/e-util/e-name-selector-list.c
@@ -424,7 +424,7 @@ popup_delete_row (GtkWidget *w,
                   PopupDeleteRowInfo *row_info)
 {
        delete_row (row_info->path, row_info->list);
-       g_free (row_info);
+       g_slice_free (PopupDeleteRowInfo, row_info);
 }
 
 static void
@@ -588,7 +588,7 @@ enl_tree_button_press_event (GtkWidget *widget,
        gtk_widget_show (menu_item);
        gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
 
-       row_info = g_new (PopupDeleteRowInfo, 1);
+       row_info = g_slice_new (PopupDeleteRowInfo);
        row_info->list = list;
        row_info->path = path;
 
diff --git a/src/e-util/e-simple-async-result.c b/src/e-util/e-simple-async-result.c
index ba3159f33c..5bb7273111 100644
--- a/src/e-util/e-simple-async-result.c
+++ b/src/e-util/e-simple-async-result.c
@@ -276,7 +276,7 @@ e_simple_async_result_thread (gpointer data,
        e_simple_async_result_complete_idle_take (td->result);
 
        g_clear_object (&td->cancellable);
-       g_free (td);
+       g_slice_free (ThreadData, td);
 }
 
 void
@@ -290,7 +290,7 @@ e_simple_async_result_run_in_thread (ESimpleAsyncResult *result,
        g_return_if_fail (E_IS_SIMPLE_ASYNC_RESULT (result));
        g_return_if_fail (func != NULL);
 
-       td = g_new0 (ThreadData, 1);
+       td = g_slice_new0 (ThreadData);
        td->result = g_object_ref (result);
        td->io_priority = io_priority;
        td->func = func;
diff --git a/src/e-util/e-source-selector.c b/src/e-util/e-source-selector.c
index f05424d8b4..83f23507b9 100644
--- a/src/e-util/e-source-selector.c
+++ b/src/e-util/e-source-selector.c
@@ -543,7 +543,7 @@ saved_status_data_free (gpointer ptr)
 
        if (data) {
                g_free (data->tooltip);
-               g_free (data);
+               g_slice_free (SavedStatusData, data);
        }
 }
 
@@ -571,7 +571,7 @@ source_selector_save_sources_status (ESourceSelector *selector)
                        path = gtk_tree_row_reference_get_path (reference);
                        gtk_tree_model_get_iter (model, &tree_iter, path);
 
-                       data = g_new0 (SavedStatusData, 1);
+                       data = g_slice_new0 (SavedStatusData);
 
                        gtk_tree_model_get (
                                model, &tree_iter,
diff --git a/src/e-util/e-text.c b/src/e-util/e-text.c
index 6b69d3769b..4a0072195b 100644
--- a/src/e-util/e-text.c
+++ b/src/e-util/e-text.c
@@ -2054,7 +2054,7 @@ popup_targets_received (GtkClipboard *clipboard,
 
        gdk_event_get_button (event, &event_button);
 
-       g_free (closure);
+       g_slice_free (PopupClosure, closure);
 
        gtk_menu_attach_to_widget (
                GTK_MENU (popup_menu),
@@ -2160,7 +2160,7 @@ e_text_do_popup (EText *text,
                  GdkEvent *button_event,
                  gint position)
 {
-       PopupClosure *closure = g_new (PopupClosure, 1);
+       PopupClosure *closure = g_slice_new (PopupClosure);
 
        closure->text = g_object_ref (text);
        closure->event = gdk_event_copy (button_event);
diff --git a/src/e-util/e-webdav-browser.c b/src/e-util/e-webdav-browser.c
index d9b42bfdc6..9a0845585c 100644
--- a/src/e-util/e-webdav-browser.c
+++ b/src/e-util/e-webdav-browser.c
@@ -138,7 +138,7 @@ resource_data_free (gpointer ptr)
 
        if (rd) {
                e_webdav_resource_free (rd->resource);
-               g_free (rd);
+               g_slice_free (ResourceData, rd);
        }
 }
 
@@ -539,7 +539,7 @@ update_ui_data_free (gpointer ptr)
                e_weak_ref_free (uud->webdav_browser_weakref);
                if (uud->free_user_data)
                        uud->free_user_data (uud->user_data);
-               g_free (uud);
+               g_slice_free (UpdateUIData, uud);
        }
 }
 
@@ -610,7 +610,7 @@ webdav_browser_schedule_ui_update (EWebDAVBrowser *webdav_browser,
        if (!webdav_browser->priv->update_ui_id) {
                UpdateUIData *uud;
 
-               uud = g_new0 (UpdateUIData, 1);
+               uud = g_slice_new0 (UpdateUIData);
                uud->webdav_browser_weakref = e_weak_ref_new (webdav_browser);
                uud->callback = callback;
                uud->user_data = user_data;
@@ -886,7 +886,7 @@ webdav_browser_gather_href_resources_sync (EWebDAVBrowser *webdav_browser,
                                g_free (resource->href);
                                resource->href = tmp;
 
-                               rd = g_new0 (ResourceData, 1);
+                               rd = g_slice_new0 (ResourceData);
                                rd->editing_flags = editing_flags;
                                rd->resource = resource;
 
@@ -927,7 +927,7 @@ search_children_data_free (gpointer ptr)
                if (scd->loading_row)
                        gtk_tree_row_reference_free (scd->loading_row);
                g_free (scd->href);
-               g_free (scd);
+               g_slice_free (SearchChildrenData, scd);
        }
 }
 
@@ -1003,7 +1003,7 @@ webdav_browser_search_children_thread (EAlertSinkThreadJobData *job_data,
 
        webdav_browser_gather_href_resources_sync (webdav_browser, session, scd->href, FALSE, TRUE, 
cancellable, error);
 
-       scd2 = g_new0 (SearchChildrenData, 1);
+       scd2 = g_slice_new0 (SearchChildrenData);
        scd2->loading_row = scd->loading_row;
        scd2->href = scd->href;
 
@@ -1368,7 +1368,7 @@ webdav_browser_row_expanded_cb (GtkTreeView *tree_view,
        g_return_if_fail (gtk_tree_model_iter_nth_child (model, &loading_child, iter, 0));
        g_return_if_fail (webdav_browser->priv->session);
 
-       scd = g_new0 (SearchChildrenData, 1);
+       scd = g_slice_new0 (SearchChildrenData);
        scd->webdav_browser_weakref = e_weak_ref_new (webdav_browser);
 
        loading_path = gtk_tree_model_get_path (model, &loading_child);
@@ -1583,7 +1583,7 @@ save_changes_data_free (gpointer ptr)
                g_free (scd->href);
                g_free (scd->name);
                g_free (scd->description);
-               g_free (scd);
+               g_slice_free (SaveChangesData, scd);
        }
 }
 
@@ -1804,7 +1804,7 @@ webdav_browser_save_clicked (EWebDAVBrowser *webdav_browser,
        gtk_text_buffer_get_start_iter (buffer, &start);
        gtk_text_buffer_get_end_iter (buffer, &end);
 
-       scd = g_new0 (SaveChangesData, 1);
+       scd = g_slice_new0 (SaveChangesData);
        scd->webdav_browser_weakref = e_weak_ref_new (webdav_browser);
        scd->href = href;
        scd->is_edit = is_edit;
@@ -2101,7 +2101,7 @@ delete_data_free (gpointer ptr)
        if (dd) {
                e_weak_ref_free (dd->webdav_browser_weakref);
                g_free (dd->href);
-               g_free (dd);
+               g_slice_free (DeleteData, dd);
        }
 }
 
@@ -2215,7 +2215,7 @@ webdav_browser_delete_clicked_cb (GtkWidget *button,
                EActivity *activity;
                DeleteData *dd;
 
-               dd = g_new0 (DeleteData, 1);
+               dd = g_slice_new0 (DeleteData);
                dd->webdav_browser_weakref = e_weak_ref_new (webdav_browser);
                dd->href = g_strdup (href);
 
diff --git a/src/libemail-engine/e-mail-session.c b/src/libemail-engine/e-mail-session.c
index ab90f9af26..c38a9a3827 100644
--- a/src/libemail-engine/e-mail-session.c
+++ b/src/libemail-engine/e-mail-session.c
@@ -372,7 +372,7 @@ archived_folder_changed_data_free (gpointer ptr)
                g_free (data->service_uid);
                g_free (data->old_folder_uri);
                g_free (data->new_folder_uri);
-               g_free (data);
+               g_slice_free (ArchiveFolderChangedData, data);
        }
 }
 
@@ -403,7 +403,7 @@ mail_session_schedule_archive_folder_changed_locked (EMailSession *session,
 {
        ArchiveFolderChangedData *data;
 
-       data = g_new0 (ArchiveFolderChangedData, 1);
+       data = g_slice_new0 (ArchiveFolderChangedData);
        data->session = e_weak_ref_new (session);
        data->service_uid = g_strdup (service_uid);
        data->old_folder_uri = g_strdup (old_folder_uri);
diff --git a/src/mail/e-mail-config-composing-page.c b/src/mail/e-mail-config-composing-page.c
index 394561fae6..b50b95fd2f 100644
--- a/src/mail/e-mail-config-composing-page.c
+++ b/src/mail/e-mail-config-composing-page.c
@@ -283,7 +283,7 @@ three_state_data_free (gpointer data,
        if (tsd) {
                g_clear_object (&tsd->composition_ext);
                g_free (tsd->property_name);
-               g_free (tsd);
+               g_slice_free (ThreeStateData, tsd);
        }
 }
 
@@ -330,7 +330,7 @@ mail_config_composing_page_setup_three_state_value (ESourceMailComposition *comp
        g_return_if_fail (property_name != NULL);
        g_return_if_fail (GTK_IS_TOGGLE_BUTTON (check_button));
 
-       tsd = g_new0 (ThreeStateData, 1);
+       tsd = g_slice_new0 (ThreeStateData);
        tsd->composition_ext = g_object_ref (composition_ext);
        tsd->property_name = g_strdup (property_name);
 
diff --git a/src/mail/e-mail-config-identity-page.c b/src/mail/e-mail-config-identity-page.c
index 66d7cdcabb..ba5bf5253c 100644
--- a/src/mail/e-mail-config-identity-page.c
+++ b/src/mail/e-mail-config-identity-page.c
@@ -990,7 +990,7 @@ name_email_pair_new (const gchar *name,
 {
        NameEmailPair *nep;
 
-       nep = g_new (NameEmailPair, 1);
+       nep = g_slice_new (NameEmailPair);
        nep->name = g_strdup (name);
        nep->email = g_strdup (email);
 
@@ -1005,7 +1005,7 @@ name_email_pair_free (gpointer ptr)
        if (nep) {
                g_free (nep->name);
                g_free (nep->email);
-               g_free (nep);
+               g_slice_free (NameEmailPair, nep);
        }
 }
 
diff --git a/src/mail/e-mail-notes.c b/src/mail/e-mail-notes.c
index b55827d64e..a730afd101 100644
--- a/src/mail/e-mail-notes.c
+++ b/src/mail/e-mail-notes.c
@@ -804,7 +804,7 @@ save_and_close_data_free (gpointer ptr)
                else
                        g_clear_object (&scd->notes_editor);
                g_clear_object (&scd->inner_message);
-               g_free (scd);
+               g_slice_free (SaveAndCloseData, scd);
        }
 }
 
@@ -851,7 +851,7 @@ action_save_and_close_cb (GtkAction *action,
 
        g_return_if_fail (E_IS_MAIL_NOTES_EDITOR (notes_editor));
 
-       scd = g_new0 (SaveAndCloseData, 1);
+       scd = g_slice_new0 (SaveAndCloseData);
        scd->notes_editor = g_object_ref (notes_editor);
        scd->inner_message = e_mail_notes_editor_encode_text_to_message (notes_editor);
        scd->success = FALSE;
@@ -1124,7 +1124,7 @@ async_data_free (gpointer ptr)
                g_clear_object (&ad->parent);
                g_clear_object (&ad->folder);
                g_free (ad->uid);
-               g_free (ad);
+               g_slice_free (AsyncData, ad);
        }
 }
 
@@ -1176,7 +1176,7 @@ e_mail_notes_edit (GtkWindow *parent,
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
        g_return_if_fail (uid != NULL);
 
-       ad = g_new0 (AsyncData, 1);
+       ad = g_slice_new0 (AsyncData);
        ad->parent = parent ? g_object_ref (parent) : NULL;
        ad->folder = g_object_ref (folder);
        ad->uid = g_strdup (uid);
diff --git a/src/mail/e-mail-reader-utils.c b/src/mail/e-mail-reader-utils.c
index 8b0c95aab7..c6afe0eadf 100644
--- a/src/mail/e-mail-reader-utils.c
+++ b/src/mail/e-mail-reader-utils.c
@@ -1087,7 +1087,7 @@ mark_ignore_thread_data_free (gpointer ptr)
        if (mit) {
                g_clear_object (&mit->folder);
                g_slist_free_full (mit->uids, (GDestroyNotify) camel_pstring_free);
-               g_free (mit);
+               g_slice_free (MarkIgnoreThreadData, mit);
        }
 }
 
@@ -1348,7 +1348,7 @@ e_mail_reader_mark_selected_ignore_thread (EMailReader *reader,
                                break;
                        }
 
-                       mit = g_new0 (MarkIgnoreThreadData, 1);
+                       mit = g_slice_new0 (MarkIgnoreThreadData);
                        mit->folder = g_object_ref (folder);
                        mit->kind = kind;
 
@@ -1933,6 +1933,12 @@ typedef struct _CreateComposerData {
        GPtrArray *attached_uids;
 } CreateComposerData;
 
+static CreateComposerData *
+create_composer_data_new (void)
+{
+       return g_slice_new0 (CreateComposerData);
+}
+
 static void
 create_composer_data_free (CreateComposerData *ccd)
 {
@@ -1948,7 +1954,7 @@ create_composer_data_free (CreateComposerData *ccd)
                g_clear_object (&ccd->attached_part);
                g_free (ccd->message_uid);
                g_free (ccd->attached_subject);
-               g_free (ccd);
+               g_slice_free (CreateComposerData, ccd);
        }
 }
 
@@ -2037,7 +2043,7 @@ mail_reader_edit_messages_cb (GObject *source_object,
        while (g_hash_table_iter_next (&iter, &key, &value)) {
                CreateComposerData *ccd;
 
-               ccd = g_new0 (CreateComposerData, 1);
+               ccd = create_composer_data_new ();
                ccd->reader = g_object_ref (async_context->reader);
                ccd->folder = g_object_ref (folder);
                ccd->message = g_object_ref (CAMEL_MIME_MESSAGE (value));
@@ -2173,7 +2179,7 @@ mail_reader_forward_attachment_cb (GObject *source_object,
                goto exit;
        }
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = create_composer_data_new ();
        ccd->reader = g_object_ref (async_context->reader);
        ccd->folder = g_object_ref (folder);
        ccd->attached_part = part;
@@ -2277,7 +2283,7 @@ mail_reader_forward_messages_cb (GObject *source_object,
                message_uid = (const gchar *) key;
                message = CAMEL_MIME_MESSAGE (value);
 
-               ccd = g_new0 (CreateComposerData, 1);
+               ccd = create_composer_data_new ();
                ccd->reader = g_object_ref (async_context->reader);
                ccd->folder = g_object_ref (folder);
                ccd->message = g_object_ref (message);
@@ -2773,7 +2779,7 @@ e_mail_reader_reply_to_message_with_selection (EMailReader *reader,
                length,
                selection_is_html ? "text/html; charset=utf-8" : "text/plain; charset=utf-8");
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = create_composer_data_new ();
        ccd->reader = g_object_ref (reader);
        ccd->folder = g_object_ref (folder);
        ccd->message_uid = g_strdup (uid);
@@ -2819,7 +2825,7 @@ whole_message:
                g_object_unref (activity);
 
        } else {
-               ccd = g_new0 (CreateComposerData, 1);
+               ccd = create_composer_data_new ();
                ccd->reader = g_object_ref (reader);
                ccd->folder = g_object_ref (folder);
                ccd->message_uid = g_strdup (uid);
diff --git a/src/mail/e-mail-reader.c b/src/mail/e-mail-reader.c
index e556516679..b1e3a80bbf 100644
--- a/src/mail/e-mail-reader.c
+++ b/src/mail/e-mail-reader.c
@@ -558,7 +558,7 @@ delete_note_data_free (gpointer ptr)
        if (dnd) {
                g_clear_object (&dnd->folder);
                g_free (dnd->uid);
-               g_free (dnd);
+               g_slice_free (DeleteNoteData, dnd);
        }
 }
 
@@ -598,7 +598,7 @@ action_mail_delete_note_cb (GtkAction *action,
                if (mail_reader_replace_vee_folder_with_real (&folder, uid, &real_uid))
                        uid = real_uid;
 
-               dnd = g_new0 (DeleteNoteData, 1);
+               dnd = g_slice_new0 (DeleteNoteData);
                dnd->folder = g_object_ref (folder);
                dnd->uid = g_strdup (uid);
 
@@ -1195,7 +1195,7 @@ mail_reader_new_composer_created_cb (GObject *source_object,
        g_clear_object (&ccd->message);
        g_clear_object (&ccd->folder);
        camel_pstring_free (ccd->message_uid);
-       g_free (ccd);
+       g_slice_free (CreateComposerData, ccd);
 }
 
 static void
@@ -1228,7 +1228,7 @@ action_mail_message_new_cb (GtkAction *action,
        shell_backend = E_SHELL_BACKEND (backend);
        shell = e_shell_backend_get_shell (shell_backend);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->reader = g_object_ref (reader);
        ccd->folder = folder;
        ccd->message_uid = camel_pstring_strdup (selected_uid);
@@ -1503,7 +1503,7 @@ mail_reader_redirect_cb (CamelFolder *folder,
        backend = e_mail_reader_get_backend (closure->reader);
        shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->reader = g_object_ref (closure->reader);
        ccd->message = message;
        ccd->message_uid = camel_pstring_strdup (closure->message_uid);
diff --git a/src/mail/e-mail-templates.c b/src/mail/e-mail-templates.c
index fd46b09bf0..b9372e9480 100644
--- a/src/mail/e-mail-templates.c
+++ b/src/mail/e-mail-templates.c
@@ -597,7 +597,7 @@ async_context_free (gpointer ptr)
                g_clear_object (&context->result_message);
                g_free (context->source_message_uid);
                g_free (context->templates_message_uid);
-               g_free (context);
+               g_slice_free (AsyncContext, context);
        }
 }
 
@@ -639,7 +639,7 @@ e_mail_templates_apply (CamelMimeMessage *source_message,
        g_return_if_fail (templates_message_uid != NULL);
        g_return_if_fail (callback != NULL);
 
-       context = g_new0 (AsyncContext, 1);
+       context = g_slice_new0 (AsyncContext);
        context->source_message = g_object_ref (source_message);
        context->source_folder = source_folder ? g_object_ref (source_folder) : NULL;
        context->source_message_uid = g_strdup (source_message_uid);
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index f94c711d86..1e8748ceb4 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -1757,7 +1757,7 @@ create_composer_data_free (gpointer ptr)
                g_clear_object (&ccd->folder);
                camel_pstring_free (ccd->message_uid);
                g_free (ccd->mailto);
-               g_free (ccd);
+               g_slice_free (CreateComposerData, ccd);
        }
 }
 
@@ -1869,7 +1869,7 @@ em_utils_compose_new_message_with_mailto_and_selection (EShell *shell,
        if (folder)
                g_return_if_fail (CAMEL_IS_FOLDER (folder));
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->folder = folder ? g_object_ref (folder) : NULL;
        ccd->message_uid = camel_pstring_strdup (message_uid);
        ccd->mailto = g_strdup (mailto);
@@ -3738,7 +3738,7 @@ alt_reply_context_free (gpointer ptr)
                g_clear_object (&context->source);
                g_clear_object (&context->new_message);
                g_free (context->message_uid);
-               g_free (context);
+               g_slice_free (AltReplyContext, context);
        }
 }
 
@@ -4338,7 +4338,7 @@ em_utils_reply_alternative (GtkWindow *parent,
                CamelFolder *template_folder = NULL;
                gchar *template_message_uid = NULL;
 
-               context = g_new0 (AltReplyContext, 1);
+               context = g_slice_new0 (AltReplyContext);
                context->shell = g_object_ref (shell);
                context->alert_sink = g_object_ref (alert_sink);
                context->source_message = g_object_ref (message);
diff --git a/src/mail/em-folder-properties.c b/src/mail/em-folder-properties.c
index a1a77c6cce..b7f8a7feba 100644
--- a/src/mail/em-folder-properties.c
+++ b/src/mail/em-folder-properties.c
@@ -99,7 +99,7 @@ folder_tweaks_data_new (const gchar *folder_uri,
 {
        FolderTweaksData *ftd;
 
-       ftd = g_new0 (FolderTweaksData, 1);
+       ftd = g_slice_new0 (FolderTweaksData);
        ftd->folder_uri = g_strdup (folder_uri);
        ftd->tweaks = g_object_ref (tweaks);
        ftd->widget = widget;
@@ -116,7 +116,7 @@ folder_tweaks_data_free (gpointer ptr,
        if (ftd) {
                g_free (ftd->folder_uri);
                g_object_unref (ftd->tweaks);
-               g_free (ftd);
+               g_slice_free (FolderTweaksData, ftd);
        }
 }
 
@@ -414,7 +414,7 @@ three_state_data_free (gpointer data,
        if (tsd) {
                g_clear_object (&tsd->folder);
                g_free (tsd->property_name);
-               g_free (tsd);
+               g_slice_free (ThreeStateData, tsd);
        }
 }
 
@@ -632,7 +632,7 @@ emfp_get_folder_item (EConfig *ec,
                                                "active", set_active,
                                                NULL);
 
-                                       tsd = g_new0 (ThreeStateData, 1);
+                                       tsd = g_slice_new0 (ThreeStateData);
                                        tsd->folder = g_object_ref (context->folder);
                                        tsd->property_name = g_strdup (properties[ii]->name);
                                        tsd->handler_id = g_signal_connect_data (widget, "toggled",
@@ -834,7 +834,7 @@ auto_archive_data_free (gpointer ptr)
                return;
 
        g_free (aad->folder_uri);
-       g_free (aad);
+       g_slice_free (AutoArchiveData, aad);
 }
 
 static void
@@ -903,7 +903,7 @@ emfp_get_autoarchive_item (EConfig *ec,
        mail_backend = E_MAIL_BACKEND (e_shell_get_backend_by_name (shell, "mail"));
        g_return_val_if_fail (mail_backend != NULL, NULL);
 
-       aad = g_new0 (AutoArchiveData, 1);
+       aad = g_slice_new0 (AutoArchiveData);
        g_object_set_data_full (G_OBJECT (ec), AUTO_ARCHIVE_KEY_DATA, aad, auto_archive_data_free);
 
        grid = GTK_GRID (gtk_grid_new ());
diff --git a/src/mail/mail-send-recv.c b/src/mail/mail-send-recv.c
index ccb5580ce7..ca4f2e08ee 100644
--- a/src/mail/mail-send-recv.c
+++ b/src/mail/mail-send-recv.c
@@ -633,7 +633,7 @@ report_error_to_ui_cb (gpointer user_data)
        g_error_free (data->error);
        if (data->send_failed_uids)
                g_ptr_array_unref (data->send_failed_uids);
-       g_free (data);
+       g_slice_free (struct ReportErrorToUIData, data);
 
        return FALSE;
 }
@@ -669,7 +669,7 @@ report_error_to_ui (CamelService *service,
                ident = "mail:failed-connect";
        }
 
-       data = g_new0 (struct ReportErrorToUIData, 1);
+       data = g_slice_new0 (struct ReportErrorToUIData);
        data->display_name = g_strdup (display_name);
        data->error_ident = g_strdup (ident);
        data->error = g_error_copy (error);
diff --git a/src/mail/message-list.c b/src/mail/message-list.c
index bd74351317..082d1f3783 100644
--- a/src/mail/message-list.c
+++ b/src/mail/message-list.c
@@ -5071,7 +5071,7 @@ folder_changed_data_free (gpointer ptr)
                e_weak_ref_free (fcd->folder);
                e_weak_ref_free (fcd->message_list);
                camel_folder_change_info_free (fcd->changes);
-               g_free (fcd);
+               g_slice_free (FolderChangedData, fcd);
        }
 }
 
@@ -5109,7 +5109,7 @@ message_list_folder_changed_cb (CamelFolder *folder,
        } else {
                FolderChangedData *fcd;
 
-               fcd = g_new0 (FolderChangedData, 1);
+               fcd = g_slice_new0 (FolderChangedData);
                fcd->folder = e_weak_ref_new (folder);
                fcd->changes = camel_folder_change_info_copy (changes);
                fcd->message_list = e_weak_ref_new (message_list);
diff --git a/src/modules/accounts-window/e-accounts-window-editors.c 
b/src/modules/accounts-window/e-accounts-window-editors.c
index 37867e4335..80acfd867e 100644
--- a/src/modules/accounts-window/e-accounts-window-editors.c
+++ b/src/modules/accounts-window/e-accounts-window-editors.c
@@ -145,7 +145,7 @@ collection_editor_data_free (gpointer ptr)
 
        if (ced) {
                g_clear_object (&ced->source);
-               g_free (ced);
+               g_slice_free (CollectionEditorData, ced);
        }
 }
 
@@ -267,7 +267,7 @@ accounts_window_editors_edit_unmanaged_collection (EAccountsWindow *accounts_win
        g_return_if_fail (E_IS_SOURCE (source));
        g_return_if_fail (e_source_has_extension (source, E_SOURCE_EXTENSION_COLLECTION));
 
-       ced = g_new0 (CollectionEditorData, 1);
+       ced = g_slice_new0 (CollectionEditorData);
        ced->source = g_object_ref (source);
 
        collection_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_COLLECTION);
diff --git a/src/modules/addressbook/eab-composer-util.c b/src/modules/addressbook/eab-composer-util.c
index bbc2efedbc..50576dd46e 100644
--- a/src/modules/addressbook/eab-composer-util.c
+++ b/src/modules/addressbook/eab-composer-util.c
@@ -161,7 +161,7 @@ eab_composer_created_cb (GObject *source_object,
                e_destination_freev (ccd->bcc_destinations);
        g_slist_free_full (ccd->attachment_destinations, g_object_unref);
 
-       g_free (ccd);
+       g_slice_free (CreateComposerData, ccd);
 }
 
 void
@@ -199,7 +199,7 @@ eab_send_as_to (EShell *shell,
        g_ptr_array_add (to_array, NULL);
        g_ptr_array_add (bcc_array, NULL);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->to_destinations = (EDestination **) g_ptr_array_free (to_array, FALSE);
        ccd->bcc_destinations = (EDestination **) g_ptr_array_free (bcc_array, FALSE);
        ccd->attachment_destinations = NULL;
@@ -218,7 +218,7 @@ eab_send_as_attachment (EShell *shell,
        if (destinations == NULL)
                return;
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->attachment_destinations = g_slist_copy (destinations);
        g_slist_foreach (ccd->attachment_destinations, (GFunc) g_object_ref, NULL);
 
diff --git a/src/modules/backup-restore/evolution-backup-restore.c 
b/src/modules/backup-restore/evolution-backup-restore.c
index a45050b824..8ad0e650cf 100644
--- a/src/modules/backup-restore/evolution-backup-restore.c
+++ b/src/modules/backup-restore/evolution-backup-restore.c
@@ -391,7 +391,7 @@ validate_backup_file_data_free (gpointer ptr)
 
                g_clear_object (&vbf->shell_window);
                g_free (vbf->path);
-               g_free (vbf);
+               g_slice_free (ValidateBackupFileData, vbf);
        }
 }
 
@@ -436,7 +436,7 @@ action_settings_restore_cb (GtkAction *action,
        shell_view = e_shell_window_get_shell_view (shell_window, e_shell_window_get_active_view 
(shell_window));
        description = g_strdup_printf (_("Checking content of backup file “%s”, please wait…"), path);
 
-       vbf = g_new0 (ValidateBackupFileData, 1);
+       vbf = g_slice_new0 (ValidateBackupFileData);
        vbf->shell_window = g_object_ref (shell_window);
        vbf->path = g_strdup (path);
 
diff --git a/src/modules/book-config-ldap/evolution-book-config-ldap.c 
b/src/modules/book-config-ldap/evolution-book-config-ldap.c
index d382ecbf55..b172153b03 100644
--- a/src/modules/book-config-ldap/evolution-book-config-ldap.c
+++ b/src/modules/book-config-ldap/evolution-book-config-ldap.c
@@ -283,7 +283,7 @@ search_base_data_free (gpointer ptr)
                g_clear_object (&sbd->source);
                g_clear_error (&sbd->error);
                g_strfreev (sbd->root_dse);
-               g_free (sbd);
+               g_slice_free (SearchBaseData, sbd);
        }
 }
 
@@ -425,7 +425,7 @@ book_config_ldap_search_base_button_clicked_cb (GtkButton *button,
        gtk_container_add (GTK_CONTAINER (content), box);
        gtk_container_set_border_width (GTK_CONTAINER (content), 12);
 
-       sbd = g_new0 (SearchBaseData, 1);
+       sbd = g_slice_new0 (SearchBaseData);
        sbd->parent = parent;
        sbd->search_base_combo = g_object_ref (context->search_base_combo);
        sbd->dialog = dialog;
diff --git a/src/modules/calendar/e-cal-attachment-handler.c b/src/modules/calendar/e-cal-attachment-handler.c
index fd9c19839d..9fff2982b9 100644
--- a/src/modules/calendar/e-cal-attachment-handler.c
+++ b/src/modules/calendar/e-cal-attachment-handler.c
@@ -130,7 +130,7 @@ import_component_data_free (gpointer ptr)
                g_clear_object (&icd->shell);
                g_clear_object (&icd->source);
                g_clear_object (&icd->icomp);
-               g_free (icd);
+               g_slice_free (ImportComponentData, icd);
        }
 }
 
@@ -349,7 +349,7 @@ attachment_handler_run_dialog (GtkWindow *parent,
                shell_view = e_shell_window_get_shell_view (shell_window,
                        e_shell_window_get_active_view (shell_window));
 
-               icd = g_new0 (ImportComponentData, 1);
+               icd = g_slice_new0 (ImportComponentData);
                icd->shell = g_object_ref (shell);
                icd->source = g_object_ref (source);
                icd->icomp = i_cal_component_clone (icomp);
diff --git a/src/modules/calendar/e-cal-base-shell-backend.c b/src/modules/calendar/e-cal-base-shell-backend.c
index 0d64a7e9fc..6c41dfcfa1 100644
--- a/src/modules/calendar/e-cal-base-shell-backend.c
+++ b/src/modules/calendar/e-cal-base-shell-backend.c
@@ -350,7 +350,7 @@ handle_uri_data_free (gpointer ptr)
        g_free (hud->source_uid);
        g_free (hud->comp_uid);
        g_free (hud->comp_rid);
-       g_free (hud);
+       g_slice_free (HandleUriData, hud);
 }
 
 static void
@@ -669,7 +669,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
                gchar *description = NULL, *alert_ident = NULL, *alert_arg_0 = NULL;
                gchar *source_display_name = NULL;
 
-               hud = g_new0 (HandleUriData, 1);
+               hud = g_slice_new0 (HandleUriData);
                hud->shell_backend = g_object_ref (shell_backend);
                hud->source_type = source_type;
                hud->source_uid = g_strdup (source_uid);
diff --git a/src/modules/calendar/e-cal-base-shell-sidebar.c b/src/modules/calendar/e-cal-base-shell-sidebar.c
index 64d541081d..44e8134384 100644
--- a/src/modules/calendar/e-cal-base-shell-sidebar.c
+++ b/src/modules/calendar/e-cal-base-shell-sidebar.c
@@ -325,7 +325,7 @@ open_client_data_free (gpointer pdata)
                g_clear_object (&data->sidebar);
                g_clear_object (&data->source);
                g_clear_object (&data->client);
-               g_free (data);
+               g_slice_free (OpenClientData, data);
        }
 }
 
@@ -394,7 +394,7 @@ e_cal_base_shell_sidebar_ensure_source_opened (ECalBaseShellSidebar *sidebar,
 
        g_free (display_name);
 
-       data = g_new0 (OpenClientData, 1);
+       data = g_slice_new0 (OpenClientData);
        data->extension_name = extension_name; /* no need to copy, it's a static string */
        data->sidebar = g_object_ref (sidebar);
        data->source = g_object_ref (source);
@@ -474,7 +474,7 @@ transfer_item_to_data_free (gpointer ptr)
                g_clear_object (&titd->destination);
                g_clear_object (&titd->selector);
                g_clear_object (&titd->icomp);
-               g_free (titd);
+               g_slice_free (TransferItemToData, titd);
        }
 }
 
@@ -584,7 +584,7 @@ e_cal_base_shell_sidebar_selector_data_dropped (ESourceSelector *selector,
                        goto exit;
        }
 
-       titd = g_new0 (TransferItemToData, 1);
+       titd = g_slice_new0 (TransferItemToData);
        titd->source = g_object_ref (source);
        titd->destination = g_object_ref (destination);
        titd->do_copy = do_copy;
diff --git a/src/modules/calendar/e-cal-shell-view-actions.c b/src/modules/calendar/e-cal-shell-view-actions.c
index 8ba8c93326..d88734a135 100644
--- a/src/modules/calendar/e-cal-shell-view-actions.c
+++ b/src/modules/calendar/e-cal-shell-view-actions.c
@@ -821,7 +821,7 @@ make_movable_data_free (gpointer ptr)
                g_free (mmd->remove_uid);
                g_free (mmd->remove_rid);
                g_clear_object (&mmd->create_icomp);
-               g_free (mmd);
+               g_slice_free (MakeMovableData, mmd);
        }
 }
 
@@ -909,7 +909,7 @@ action_event_occurrence_movable_cb (GtkAction *action,
 
        e_cal_component_commit_sequence (exception_component);
 
-       mmd = g_new0 (MakeMovableData, 1);
+       mmd = g_slice_new0 (MakeMovableData);
        mmd->client = g_object_ref (client);
        mmd->remove_uid = g_strdup (e_cal_component_id_get_uid (id));
        mmd->remove_rid = g_strdup (e_cal_component_id_get_rid (id));
diff --git a/src/modules/calendar/e-cal-shell-view-private.c b/src/modules/calendar/e-cal-shell-view-private.c
index f9b7c52eea..3701d390ed 100644
--- a/src/modules/calendar/e-cal-shell-view-private.c
+++ b/src/modules/calendar/e-cal-shell-view-private.c
@@ -719,7 +719,7 @@ cal_searching_instances_done_cb (gpointer user_data)
        }
 
        g_object_unref (gid->cancellable);
-       g_free (gid);
+       g_slice_free (struct GenerateInstancesData, gid);
 }
 
 static gboolean
@@ -838,7 +838,7 @@ cal_search_get_object_list_cb (GObject *source,
                        ICalComponent *icomp = iter->data;
                        struct GenerateInstancesData *gid;
 
-                       gid = g_new0 (struct GenerateInstancesData, 1);
+                       gid = g_slice_new0 (struct GenerateInstancesData);
                        gid->client = client;
                        gid->cal_shell_view = cal_shell_view;
                        gid->cancellable = g_object_ref (cancellable);
diff --git a/src/modules/composer-autosave/e-autosave-utils.c 
b/src/modules/composer-autosave/e-autosave-utils.c
index fabd89d019..2080f6d957 100644
--- a/src/modules/composer-autosave/e-autosave-utils.c
+++ b/src/modules/composer-autosave/e-autosave-utils.c
@@ -145,7 +145,7 @@ autosave_composer_created_cb (GObject *source_object,
        g_clear_object (&ccd->simple);
        g_clear_object (&ccd->message);
        g_clear_object (&ccd->snapshot_file);
-       g_free (ccd);
+       g_slice_free (CreateComposerData, ccd);
 }
 
 static void
@@ -202,7 +202,7 @@ load_snapshot_loaded_cb (GFile *snapshot_file,
         * the same file. */
        shell = E_SHELL (object);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->simple = simple;
        ccd->context = context;
        ccd->message = message;
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 5c8941a96f..67aef5f019 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -3958,7 +3958,7 @@ decrease_find_data (FormatItipFindData *fd)
                g_free (fd->rid);
                if (fd->sexp)
                        g_free (fd->sexp);
-               g_free (fd);
+               g_slice_free (FormatItipFindData, fd);
        }
 }
 
@@ -4313,7 +4313,7 @@ find_server (ItipView *view,
                if (!fd) {
                        gchar *start = NULL, *end = NULL;
 
-                       fd = g_new0 (FormatItipFindData, 1);
+                       fd = g_slice_new0 (FormatItipFindData);
                        fd->view = g_object_ref (view);
                        fd->itip_cancellable = g_object_ref (view->priv->cancellable);
                        fd->cancellable = g_cancellable_new ();
diff --git a/src/modules/mail/e-mail-attachment-handler.c b/src/modules/mail/e-mail-attachment-handler.c
index cf782d9c32..e3be4f620f 100644
--- a/src/modules/mail/e-mail-attachment-handler.c
+++ b/src/modules/mail/e-mail-attachment-handler.c
@@ -184,7 +184,7 @@ create_composer_data_free (CreateComposerData *ccd)
        if (ccd) {
                g_clear_object (&ccd->message);
                g_clear_object (&ccd->folder);
-               g_free (ccd);
+               g_slice_free (CreateComposerData, ccd);
        }
 }
 
@@ -243,7 +243,7 @@ mail_attachment_handler_forward_with_style (EAttachmentHandler *handler,
        folder = mail_attachment_handler_guess_folder_ref (handler);
        shell = e_shell_backend_get_shell (E_SHELL_BACKEND (priv->backend));
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->message = message;
        ccd->folder = folder;
        ccd->is_forward = TRUE;
@@ -284,7 +284,7 @@ mail_attachment_handler_reply (EAttachmentHandler *handler,
        shell_backend = E_SHELL_BACKEND (priv->backend);
        shell = e_shell_backend_get_shell (shell_backend);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->message = message;
        ccd->reply_type = reply_type;
        ccd->is_reply = TRUE;
@@ -331,7 +331,7 @@ mail_attachment_handler_message_edit (GtkAction *action,
        shell = e_shell_backend_get_shell (E_SHELL_BACKEND (priv->backend));
        folder = mail_attachment_handler_guess_folder_ref (handler);
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->message = message;
        ccd->folder = folder;
 
@@ -374,7 +374,7 @@ mail_attachment_handler_redirect (GtkAction *action,
 
        shell = e_shell_backend_get_shell (E_SHELL_BACKEND (priv->backend));
 
-       ccd = g_new0 (CreateComposerData, 1);
+       ccd = g_slice_new0 (CreateComposerData);
        ccd->message = message;
        ccd->folder = NULL;
        ccd->is_redirect = TRUE;
diff --git a/src/modules/mail/e-mail-shell-backend.c b/src/modules/mail/e-mail-shell-backend.c
index 9db7468641..12c38fe3ec 100644
--- a/src/modules/mail/e-mail-shell-backend.c
+++ b/src/modules/mail/e-mail-shell-backend.c
@@ -329,7 +329,7 @@ action_mail_message_new_composer_created_cb (GObject *source_object,
 
        g_clear_object (&ncd->folder);
        camel_pstring_free (ncd->message_uid);
-       g_free (ncd);
+       g_slice_free (NewComposerData, ncd);
 }
 
 static void
@@ -385,7 +385,7 @@ action_mail_message_new_cb (GtkAction *action,
        }
 
  exit:
-       ncd = g_new0 (NewComposerData, 1);
+       ncd = g_slice_new0 (NewComposerData);
        ncd->folder = folder;
        ncd->message_uid = message_uid;
 
diff --git a/src/modules/mail/e-mail-shell-view-actions.c b/src/modules/mail/e-mail-shell-view-actions.c
index 154906bef8..e6c1742542 100644
--- a/src/modules/mail/e-mail-shell-view-actions.c
+++ b/src/modules/mail/e-mail-shell-view-actions.c
@@ -1134,7 +1134,7 @@ get_folder_data_free (GetFolderData *gfd)
                g_clear_object (&gfd->activity);
                g_clear_object (&gfd->store);
                g_free (gfd->folder_name);
-               g_free (gfd);
+               g_slice_free (GetFolderData, gfd);
        }
 }
 
@@ -1199,7 +1199,7 @@ action_mail_folder_unsubscribe_cb (GtkAction *action,
        g_return_if_fail (CAMEL_IS_STORE (selected_store));
        g_return_if_fail (selected_folder_name != NULL);
 
-       gfd = g_new0 (GetFolderData, 1);
+       gfd = g_slice_new0 (GetFolderData);
        gfd->mail_shell_view = g_object_ref (mail_shell_view);
        gfd->activity = e_mail_reader_new_activity (E_MAIL_READER (mail_view));
        gfd->store = selected_store;
diff --git a/src/modules/mail/e-mail-shell-view-private.c b/src/modules/mail/e-mail-shell-view-private.c
index decdf848e3..364e08ea5d 100644
--- a/src/modules/mail/e-mail-shell-view-private.c
+++ b/src/modules/mail/e-mail-shell-view-private.c
@@ -1167,7 +1167,7 @@ free_menu_item_sensitivity_data (gpointer ptr)
 
        g_object_unref (data->service);
        g_object_unref (data->menu_item);
-       g_free (data);
+       g_slice_free (EMenuItemSensitivityData, data);
 }
 
 static gboolean
@@ -1195,7 +1195,7 @@ service_online_state_changed_cb (GObject *service,
        g_return_if_fail (G_IS_OBJECT (service));
        g_return_if_fail (GTK_IS_WIDGET (menu_item));
 
-       data = g_new0 (EMenuItemSensitivityData, 1);
+       data = g_slice_new0 (EMenuItemSensitivityData);
        data->service = g_object_ref (service);
        data->menu_item = g_object_ref (menu_item);
 
diff --git a/src/plugins/bbdb/bbdb.c b/src/plugins/bbdb/bbdb.c
index f748f39a7a..3c08f19f26 100644
--- a/src/plugins/bbdb/bbdb.c
+++ b/src/plugins/bbdb/bbdb.c
@@ -125,7 +125,7 @@ free_todo_struct (todo_struct *td)
        if (td) {
                g_free (td->name);
                g_free (td->email);
-               g_free (td);
+               g_slice_free (todo_struct, td);
        }
 }
 
@@ -190,7 +190,7 @@ todo_queue_process (const gchar *name,
 {
        todo_struct *td;
 
-       td = g_new (todo_struct, 1);
+       td = g_slice_new (todo_struct);
        td->name = g_strdup (name);
        td->email = g_strdup (email);
 
diff --git a/src/plugins/external-editor/external-editor.c b/src/plugins/external-editor/external-editor.c
index 51d91109c3..cc77b75fc1 100644
--- a/src/plugins/external-editor/external-editor.c
+++ b/src/plugins/external-editor/external-editor.c
@@ -226,7 +226,7 @@ update_composer_text (gpointer user_data)
 
        g_clear_object (&eed->composer);
        g_free (eed->content);
-       g_free (eed);
+       g_slice_free (struct ExternalEditorData, eed);
 
        return FALSE;
 }
@@ -239,15 +239,17 @@ struct run_error_dialog_data
 
 /* needed because the new thread needs to call g_idle_add () */
 static gboolean
-run_error_dialog (struct run_error_dialog_data *data)
+run_error_dialog (gpointer user_data)
 {
+       struct run_error_dialog_data *data = user_data;
+
        g_return_val_if_fail (data != NULL, FALSE);
 
        e_alert_run_dialog_for_args (GTK_WINDOW (data->composer), data->text, NULL);
        enable_composer (data->composer);
 
        g_clear_object (&data->composer);
-       g_free (data);
+       g_slice_free (struct run_error_dialog_data, data);
 
        return FALSE;
 }
@@ -302,14 +304,14 @@ external_editor_thread (gpointer user_data)
        } else {
                struct run_error_dialog_data *data;
 
-               data = g_new0 (struct run_error_dialog_data, 1);
+               data = g_slice_new0 (struct run_error_dialog_data);
                data->composer = g_object_ref (eed->composer);
                data->text = "org.gnome.evolution.plugins.external-editor:no-temp-file";
 
                g_warning ("Temporary file fd is null");
 
                /* run_error_dialog also calls enable_composer */
-               g_idle_add ((GSourceFunc) run_error_dialog, data);
+               g_idle_add (run_error_dialog, data);
 
                goto finished;
        }
@@ -354,12 +356,12 @@ external_editor_thread (gpointer user_data)
 
                g_warning ("Unable to launch %s: ", editor_cmd_line);
 
-               data = g_new0 (struct run_error_dialog_data, 1);
+               data = g_slice_new0 (struct run_error_dialog_data);
                data->composer = g_object_ref (eed->composer);
                data->text = "org.gnome.evolution.plugins.external-editor:editor-not-launchable";
 
                /* run_error_dialog also calls enable_composer */
-               g_idle_add ((GSourceFunc) run_error_dialog, data);
+               g_idle_add (run_error_dialog, data);
 
                g_free (filename);
                g_free (editor_cmd_line);
@@ -383,7 +385,7 @@ external_editor_thread (gpointer user_data)
                if (g_file_get_contents (filename, &buf, NULL, NULL)) {
                        struct ExternalEditorData *eed2;
 
-                       eed2 = g_new0 (struct ExternalEditorData, 1);
+                       eed2 = g_slice_new0 (struct ExternalEditorData);
                        eed2->composer = g_object_ref (eed->composer);
                        eed2->content =  camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_PRE, 0);
 
@@ -405,7 +407,7 @@ finished:
 
        g_clear_object (&eed->composer);
        g_free (eed->content);
-       g_free (eed);
+       g_slice_free (struct ExternalEditorData, eed);
 
        return NULL;
 }
@@ -433,7 +435,7 @@ static void launch_editor (GtkAction *action, EMsgComposer *composer)
        external_editor_running = TRUE;
        g_mutex_unlock (&external_editor_running_lock);
 
-       eed = g_new0 (struct ExternalEditorData, 1);
+       eed = g_slice_new0 (struct ExternalEditorData);
        eed->composer = g_object_ref (composer);
        eed->content = e_content_editor_get_content (cnt_editor,
                E_CONTENT_EDITOR_GET_TEXT_PLAIN |
diff --git a/src/plugins/mail-to-task/mail-to-task.c b/src/plugins/mail-to-task/mail-to-task.c
index ca443dcda5..d81cd9d610 100644
--- a/src/plugins/mail-to-task/mail-to-task.c
+++ b/src/plugins/mail-to-task/mail-to-task.c
@@ -533,7 +533,7 @@ do_report_error (struct _report_error *err)
                e_notice (NULL, GTK_MESSAGE_ERROR, err->format, err->param);
                g_free (err->format);
                g_free (err->param);
-               g_free (err);
+               g_slice_free (struct _report_error, err);
        }
 
        return FALSE;
@@ -543,7 +543,7 @@ static void
 report_error_idle (const gchar *format,
                    const gchar *param)
 {
-       struct _report_error *err = g_new (struct _report_error, 1);
+       struct _report_error *err = g_slice_new (struct _report_error);
 
        err->format = g_strdup (format);
        err->param = g_strdup (param);
@@ -578,7 +578,7 @@ free_manage_comp_struct (struct _manage_comp *mc)
        if (mc->editor_title)
                g_free (mc->editor_title);
 
-       g_free (mc);
+       g_slice_free (struct _manage_comp, mc);
 }
 
 static gint
@@ -842,7 +842,20 @@ typedef struct {
        gchar *default_charset;
        gchar *forced_charset;
        gboolean with_attendees;
-}AsyncData;
+} AsyncData;
+
+static void
+async_data_free (AsyncData *data)
+{
+       if (data) {
+               g_free (data->selected_text);
+               g_free (data->default_charset);
+               g_free (data->forced_charset);
+               g_object_unref (data->client_cache);
+               g_object_unref (data->source);
+               g_slice_free (AsyncData, data);
+       }
+}
 
 static gboolean
 do_mail_to_event (AsyncData *data)
@@ -990,7 +1003,7 @@ do_mail_to_event (AsyncData *data)
                        i_cal_property_set_x_name (prop, "X-EVOLUTION-MOVE-CALENDAR");
                        i_cal_component_take_property (icomp, prop);
 
-                       mc = g_new0 (struct _manage_comp, 1);
+                       mc = g_slice_new0 (struct _manage_comp);
                        mc->client = g_object_ref (client);
                        mc->comp = g_object_ref (comp);
                        g_mutex_init (&mc->mutex);
@@ -1050,17 +1063,8 @@ do_mail_to_event (AsyncData *data)
        g_ptr_array_unref (uids);
        g_object_unref (folder);
 
-       if (data->selected_text)
-               g_free (data->selected_text);
-       g_free (data->default_charset);
-       g_free (data->forced_charset);
-       g_object_unref (data->client_cache);
-       g_object_unref (data->source);
-       g_free (data);
-       data = NULL;
-
-       if (error != NULL)
-               g_error_free (error);
+       async_data_free (data);
+       g_clear_error (&error);
 
        return TRUE;
 }
@@ -1117,6 +1121,7 @@ start_mail_to_event_thread (AsyncData *data)
        if (error != NULL) {
                g_warning (G_STRLOC ": %s", error->message);
                g_error_free (error);
+               async_data_free (data);
        } else {
                g_thread_unref (thread);
        }
@@ -1254,11 +1259,11 @@ mail_to_event (ECalClientSourceType source_type,
 
        if (source) {
                /* if a source has been selected, perform the mail2event operation */
-               AsyncData *data = NULL;
+               AsyncData *data;
                EMailDisplay *mail_display;
 
                /* Fill the elements in AsynData */
-               data = g_new0 (AsyncData, 1);
+               data = g_slice_new0 (AsyncData);
                data->client_cache = g_object_ref (e_shell_get_client_cache (shell));
                data->source = g_object_ref (source);
                data->extension_name = extension_name;
diff --git a/src/plugins/mailing-list-actions/mailing-list-actions.c 
b/src/plugins/mailing-list-actions/mailing-list-actions.c
index c9be89318e..c5fade24e0 100644
--- a/src/plugins/mailing-list-actions/mailing-list-actions.c
+++ b/src/plugins/mailing-list-actions/mailing-list-actions.c
@@ -152,7 +152,7 @@ send_message_composer_created_cb (GObject *source_object,
 
        g_free (smd->url);
        g_free (smd->uid);
-       g_free (smd);
+       g_slice_free (SendMessageData, smd);
 }
 
 static void
@@ -279,7 +279,7 @@ emla_list_action_cb (CamelFolder *folder,
                        if (send_message_response == GTK_RESPONSE_YES) {
                                SendMessageData *smd;
 
-                               smd = g_new0 (SendMessageData, 1);
+                               smd = g_slice_new0 (SendMessageData);
                                smd->url = g_strdup (url);
                                smd->uid = g_strdup (uid);
 
diff --git a/src/plugins/publish-calendar/publish-calendar.c b/src/plugins/publish-calendar/publish-calendar.c
index c985f8175e..00e4a37a61 100644
--- a/src/plugins/publish-calendar/publish-calendar.c
+++ b/src/plugins/publish-calendar/publish-calendar.c
@@ -1043,7 +1043,7 @@ error_queue_show_idle (gpointer user_data)
                                has_info = TRUE;
                        }
 
-                       g_free (data);
+                       g_slice_free (struct eq_data, data);
                }
        }
 
@@ -1072,7 +1072,7 @@ error_queue_add (gchar *description,
        if (!error && !description)
                return;
 
-       data = g_new0 (struct eq_data, 1);
+       data = g_slice_new0 (struct eq_data);
        data->description = description;
        data->error = error;
 
diff --git a/src/plugins/templates/templates.c b/src/plugins/templates/templates.c
index 746db14239..6345be0bef 100644
--- a/src/plugins/templates/templates.c
+++ b/src/plugins/templates/templates.c
@@ -779,7 +779,7 @@ save_template_async_data_free (gpointer ptr)
                g_clear_object (&sta->message);
                g_clear_object (&sta->info);
                g_free (sta->templates_folder_uri);
-               g_free (sta);
+               g_slice_free (SaveTemplateAsyncData, sta);
        }
 }
 
@@ -865,7 +865,7 @@ got_message_draft_cb (EMsgComposer *composer,
                info, CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DRAFT |
                (camel_mime_message_has_attachment (message) ? CAMEL_MESSAGE_ATTACHMENTS : 0), ~0);
 
-       sta = g_new0 (SaveTemplateAsyncData, 1);
+       sta = g_slice_new0 (SaveTemplateAsyncData);
        sta->composer = g_object_ref (composer);
        sta->session = g_object_ref (session);
        sta->message = message;
diff --git a/src/shell/e-shell-taskbar.c b/src/shell/e-shell-taskbar.c
index 04194b1e52..44928ac353 100644
--- a/src/shell/e-shell-taskbar.c
+++ b/src/shell/e-shell-taskbar.c
@@ -82,7 +82,7 @@ shell_taskbar_free_idle_data (gpointer data)
 
        g_clear_object (&idle_data->shell_taskbar);
        g_clear_object (&idle_data->activity);
-       g_free (idle_data);
+       g_slice_free (EShellTaskbarIdleData, idle_data);
 }
 
 static void
@@ -134,7 +134,7 @@ shell_taskbar_weak_notify_cb (EShellTaskbar *shell_taskbar,
        } else {
                EShellTaskbarIdleData *idle_data;
 
-               idle_data = g_new0 (EShellTaskbarIdleData, 1);
+               idle_data = g_slice_new0 (EShellTaskbarIdleData);
                idle_data->shell_taskbar = g_object_ref (shell_taskbar);
                idle_data->proxy = proxy;
 
@@ -206,7 +206,7 @@ shell_taskbar_activity_added_cb (EShellTaskbar *shell_taskbar,
        } else {
                EShellTaskbarIdleData *idle_data;
 
-               idle_data = g_new0 (EShellTaskbarIdleData, 1);
+               idle_data = g_slice_new0 (EShellTaskbarIdleData);
                idle_data->shell_taskbar = g_object_ref (shell_taskbar);
                idle_data->activity = g_object_ref (activity);
 
diff --git a/src/shell/e-shell-window.c b/src/shell/e-shell-window.c
index 7bc4cf2f34..20d8f67c55 100644
--- a/src/shell/e-shell-window.c
+++ b/src/shell/e-shell-window.c
@@ -1847,7 +1847,7 @@ connect_client_data_free (gpointer ptr)
                if (cc_data->destroy_user_data)
                        cc_data->destroy_user_data (cc_data->user_data);
 
-               g_free (cc_data);
+               g_slice_free (ConnectClientData, cc_data);
        }
 }
 
@@ -1922,7 +1922,7 @@ e_shell_window_connect_client (EShellWindow *shell_window,
 
        g_free (display_name);
 
-       cc_data = g_new0 (ConnectClientData, 1);
+       cc_data = g_slice_new0 (ConnectClientData);
        cc_data->shell_window = g_object_ref (shell_window);
        cc_data->source = g_object_ref (source);
        cc_data->extension_name = g_strdup (extension_name);
diff --git a/src/shell/e-shell.c b/src/shell/e-shell.c
index 2ced59b9fd..b384ed5067 100644
--- a/src/shell/e-shell.c
+++ b/src/shell/e-shell.c
@@ -861,7 +861,7 @@ trust_prompt_data_free (gpointer ptr)
 
        if (tpd) {
                g_free (tpd->original_ssl_trust);
-               g_free (tpd);
+               g_slice_free (TrustPromptData, tpd);
        }
 }
 
@@ -1037,7 +1037,7 @@ shell_connect_trust_error_alert_response_cb (EAlert *alert,
 
        g_object_set_data_full (G_OBJECT (source), SOURCE_ALERT_KEY_CERTIFICATE_PEM, g_strdup 
(certificate_pem), g_free);
 
-       tpd = g_new0 (TrustPromptData, 1);
+       tpd = g_slice_new0 (TrustPromptData);
        tpd->shell = shell;
        tpd->original_ssl_trust = shell_extract_ssl_trust (source);
 
@@ -1277,7 +1277,7 @@ shell_process_credentials_required_errors (EShell *shell,
 
                                g_object_set_data_full (G_OBJECT (source), SOURCE_ALERT_KEY_CERTIFICATE_PEM, 
g_strdup (certificate_pem), g_free);
 
-                               tpd = g_new0 (TrustPromptData, 1);
+                               tpd = g_slice_new0 (TrustPromptData);
                                tpd->shell = shell;
                                tpd->original_ssl_trust = shell_extract_ssl_trust (source);
 
diff --git a/src/smime/gui/certificate-manager.c b/src/smime/gui/certificate-manager.c
index 158d407a90..9f6d5337c1 100644
--- a/src/smime/gui/certificate-manager.c
+++ b/src/smime/gui/certificate-manager.c
@@ -1721,7 +1721,7 @@ load_all_certs_async_data_free (gpointer ptr)
                g_clear_object (&data->ecmc);
                g_clear_object (&data->cancellable);
                g_slist_free_full (data->ecerts, g_object_unref);
-               g_free (data);
+               g_slice_free (LoadAllCertsAsyncData, data);
        }
 }
 
@@ -1842,7 +1842,7 @@ load_all_certs (ECertManagerConfig *ecmc)
 
        ecmc->priv->load_all_certs_cancellable = g_cancellable_new ();
 
-       data = g_new0 (LoadAllCertsAsyncData, 1);
+       data = g_slice_new0 (LoadAllCertsAsyncData);
        data->ecmc = g_object_ref (ecmc);
        data->cancellable = g_object_ref (ecmc->priv->load_all_certs_cancellable);
        data->ecerts = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]