aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-15 02:15:36 +0800
committerMilan Crha <mcrha@redhat.com>2011-02-15 02:15:36 +0800
commit4b9ac3879d25d14cbaaab9237626257c3561f7ff (patch)
treef9a445d2652644ea9ed64da2cd76f1ad442e83b3 /mail
parentcf41379058d6e78ea138603186acb8174c58e0ca (diff)
downloadgsoc2013-evolution-4b9ac3879d25d14cbaaab9237626257c3561f7ff.tar.gz
gsoc2013-evolution-4b9ac3879d25d14cbaaab9237626257c3561f7ff.tar.zst
gsoc2013-evolution-4b9ac3879d25d14cbaaab9237626257c3561f7ff.zip
Fix few memory leaks
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-reader.c5
-rw-r--r--mail/em-folder-tree.c10
-rw-r--r--mail/message-list.c21
3 files changed, 31 insertions, 5 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index d7942d0985..a56b514227 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2582,7 +2582,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
{
EMailReader *reader;
EMailReaderPrivate *priv;
- CamelMimeMessage *message;
+ CamelMimeMessage *message = NULL;
EMFormatHTML *formatter;
GtkWidget *message_list;
EMailBackend *backend;
@@ -2703,6 +2703,9 @@ exit:
priv->restoring_message_selection = FALSE;
mail_reader_closure_free (closure);
+
+ if (message)
+ g_object_unref (message);
}
static gboolean
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 3472d690ce..51a116f643 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2027,7 +2027,7 @@ tree_drag_data_received (GtkWidget *widget,
GtkTreeViewDropPosition pos;
GtkTreeModel *model;
GtkTreeView *tree_view;
- GtkTreePath *dest_path;
+ GtkTreePath *dest_path = NULL;
EMailSession *session;
struct _DragDataReceivedAsync *m;
gboolean is_store;
@@ -2046,16 +2046,19 @@ tree_drag_data_received (GtkWidget *widget,
/* this means we are receiving no data */
if (gtk_selection_data_get_data (selection) == NULL) {
gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME);
+ gtk_tree_path_free (dest_path);
return;
}
if (gtk_selection_data_get_length (selection) == -1) {
gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME);
+ gtk_tree_path_free (dest_path);
return;
}
if (!gtk_tree_model_get_iter (model, &iter, dest_path)) {
gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME);
+ gtk_tree_path_free (dest_path);
return;
}
@@ -2068,6 +2071,7 @@ tree_drag_data_received (GtkWidget *widget,
/* make sure user isn't try to drop on a placeholder row */
if (full_name == NULL && !is_store) {
gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME);
+ gtk_tree_path_free (dest_path);
return;
}
@@ -2083,6 +2087,7 @@ tree_drag_data_received (GtkWidget *widget,
m->selection = gtk_selection_data_copy (selection);
tree_drag_data_action (m);
+ gtk_tree_path_free (dest_path);
}
static gboolean
@@ -2475,7 +2480,7 @@ tree_drag_motion (GtkWidget *widget,
GdkDragAction actions;
GdkDragAction suggested_action;
GdkDragAction chosen_action = 0;
- GtkTreePath *path;
+ GtkTreePath *path = NULL;
GtkTreeIter iter;
GdkAtom target;
gint i;
@@ -2552,6 +2557,7 @@ tree_drag_motion (GtkWidget *widget,
}
gdk_drag_status (context, chosen_action, time);
+ gtk_tree_path_free (path);
return chosen_action != 0;
}
diff --git a/mail/message-list.c b/mail/message-list.c
index 2820d79bf2..3bc5915f14 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1922,6 +1922,9 @@ static ECell * create_composite_cell (gint col)
e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_from, show_email ? col : alt_col, 68);
e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_attach, COL_ATTACHMENT, 5);
e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_date, COL_SENT, 27);
+ g_object_unref (cell_from);
+ g_object_unref (cell_attach);
+ g_object_unref (cell_date);
cell_sub = e_cell_text_new (fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT);
g_object_set (G_OBJECT (cell_sub),
@@ -1931,6 +1934,9 @@ static ECell * create_composite_cell (gint col)
cell_tree = e_cell_tree_new (TRUE, cell_sub);
e_cell_vbox_append (E_CELL_VBOX (cell_vbox), cell_hbox, COL_FROM);
e_cell_vbox_append (E_CELL_VBOX (cell_vbox), cell_tree, COL_SUBJECT);
+ g_object_unref (cell_sub);
+ g_object_unref (cell_hbox);
+ g_object_unref (cell_tree);
g_object_set_data (G_OBJECT (cell_vbox), "cell_date", cell_date);
g_object_set_data (G_OBJECT (cell_vbox), "cell_sub", cell_sub);
@@ -1966,22 +1972,27 @@ message_list_create_extras (void)
cell = e_cell_toggle_new (
status_icons, G_N_ELEMENTS (status_icons));
e_table_extras_add_cell (extras, "render_message_status", cell);
+ g_object_unref (cell);
cell = e_cell_toggle_new (
attachment_icons, G_N_ELEMENTS (attachment_icons));
e_table_extras_add_cell (extras, "render_attachment", cell);
+ g_object_unref (cell);
cell = e_cell_toggle_new (
flagged_icons, G_N_ELEMENTS (flagged_icons));
e_table_extras_add_cell (extras, "render_flagged", cell);
+ g_object_unref (cell);
cell = e_cell_toggle_new (
followup_icons, G_N_ELEMENTS (followup_icons));
e_table_extras_add_cell (extras, "render_flag_status", cell);
+ g_object_unref (cell);
cell = e_cell_toggle_new (
score_icons, G_N_ELEMENTS (score_icons));
e_table_extras_add_cell (extras, "render_score", cell);
+ g_object_unref (cell);
/* date cell */
cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1991,6 +2002,7 @@ message_list_create_extras (void)
"color_column", COL_COLOUR,
NULL);
e_table_extras_add_cell (extras, "render_date", cell);
+ g_object_unref (cell);
/* text cell */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1999,9 +2011,11 @@ message_list_create_extras (void)
"color_column", COL_COLOUR,
NULL);
e_table_extras_add_cell (extras, "render_text", cell);
+ g_object_unref (cell);
- e_table_extras_add_cell (extras, "render_tree",
- e_cell_tree_new (TRUE, cell));
+ cell = e_cell_tree_new (TRUE, cell);
+ e_table_extras_add_cell (extras, "render_tree", cell);
+ g_object_unref (cell);
/* size cell */
cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT);
@@ -2010,13 +2024,16 @@ message_list_create_extras (void)
"color_column", COL_COLOUR,
NULL);
e_table_extras_add_cell (extras, "render_size", cell);
+ g_object_unref (cell);
/* Composite cell for wide view */
cell = create_composite_cell (COL_FROM);
e_table_extras_add_cell (extras, "render_composite_from", cell);
+ g_object_unref (cell);
cell = create_composite_cell (COL_TO);
e_table_extras_add_cell (extras, "render_composite_to", cell);
+ g_object_unref (cell);
/* set proper format component for a default 'date' cell renderer */
cell = e_table_extras_get_cell (extras, "date");