[evolution] Fix few memory leaks
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Fix few memory leaks
- Date: Mon, 9 Jan 2017 13:51:42 +0000 (UTC)
commit 078bb933d7da31e3c99503d098741892993dea54
Author: Milan Crha <mcrha redhat com>
Date: Mon Jan 9 14:52:27 2017 +0100
Fix few memory leaks
src/calendar/gui/itip-utils.c | 6 +++++-
src/e-util/e-name-selector-entry.c | 5 ++++-
src/modules/itip-formatter/e-mail-formatter-itip.c | 16 ++++++++++++----
.../e-mail-display-popup-text-highlight.c | 18 ++++++++++++++++++
4 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index 4793b8b..f126e9c 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -591,6 +591,8 @@ itip_get_comp_attendee (ESourceRegistry *registry,
g_hash_table_destroy (aliases);
g_free (address);
+ g_list_free_full (list, g_object_unref);
+
return user_email;
}
@@ -608,6 +610,8 @@ itip_get_comp_attendee (ESourceRegistry *registry,
g_hash_table_destroy (aliases);
g_free (address);
+ g_list_free_full (list, g_object_unref);
+
return user_email;
}
@@ -616,7 +620,7 @@ itip_get_comp_attendee (ESourceRegistry *registry,
g_free (address);
}
- g_list_free_full (list, (GDestroyNotify) g_object_unref);
+ g_list_free_full (list, g_object_unref);
/* We could not find the attendee in the component, so just give
* the default account address if the email address is not set in
diff --git a/src/e-util/e-name-selector-entry.c b/src/e-util/e-name-selector-entry.c
index c7a8f4a..20cc646 100644
--- a/src/e-util/e-name-selector-entry.c
+++ b/src/e-util/e-name-selector-entry.c
@@ -2047,7 +2047,6 @@ user_focus_in (ENameSelectorEntry *name_selector_entry,
gint n;
GList *l, *known;
GString *str = g_string_new ("");
- EDestination *dest_dummy = e_destination_new ();
gint sel_start_pos = -1, sel_end_pos = -1;
g_signal_handlers_block_matched (name_selector_entry, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL,
name_selector_entry);
@@ -2073,10 +2072,14 @@ user_focus_in (ENameSelectorEntry *name_selector_entry,
g_list_free (known);
if (str->len > 1 && str->str && str->str[str->len - 1] != ' ' && str->str[str->len - 2] != ',') {
+ EDestination *dest_dummy = e_destination_new ();
+
/* Add a blank destination */
e_destination_store_append_destination (name_selector_entry->priv->destination_store,
dest_dummy);
if (str->str && str->str[0])
g_string_append (str, ", ");
+
+ g_clear_object (&dest_dummy);
}
gtk_editable_get_selection_bounds (GTK_EDITABLE (name_selector_entry), &sel_start_pos, &sel_end_pos);
diff --git a/src/modules/itip-formatter/e-mail-formatter-itip.c
b/src/modules/itip-formatter/e-mail-formatter-itip.c
index a77bdbe..a2d10c8 100644
--- a/src/modules/itip-formatter/e-mail-formatter-itip.c
+++ b/src/modules/itip-formatter/e-mail-formatter-itip.c
@@ -85,11 +85,11 @@ emfe_itip_format (EMailFormatterExtension *extension,
itip_view_write (itip_part, formatter, buffer);
} else {
- CamelFolder *folder;
- CamelMimeMessage *message;
+ CamelFolder *folder, *old_folder;
+ CamelMimeMessage *message, *old_message;
const gchar *message_uid;
const gchar *default_charset, *charset;
- gchar *uri;
+ gchar *uri, *old_message_uid;
folder = e_mail_part_list_get_folder (context->part_list);
message = e_mail_part_list_get_message (context->part_list);
@@ -105,9 +105,17 @@ emfe_itip_format (EMailFormatterExtension *extension,
folder, message_uid, "$has_cal", TRUE);
}
+ old_folder = itip_part->folder;
+ old_message = itip_part->message;
+ old_message_uid = itip_part->message_uid;
+
itip_part->folder = g_object_ref (folder);
- itip_part->message_uid = g_strdup (message_uid);
itip_part->message = g_object_ref (message);
+ itip_part->message_uid = g_strdup (message_uid);
+
+ g_clear_object (&old_folder);
+ g_clear_object (&old_message);
+ g_free (old_message_uid);
default_charset = e_mail_formatter_get_default_charset (formatter);
charset = e_mail_formatter_get_charset (formatter);
diff --git a/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
b/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
index 646745a..cbbab26 100644
--- a/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
+++ b/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
@@ -327,6 +327,20 @@ update_actions (EMailDisplayPopupExtension *extension,
}
}
+static void
+e_mail_display_popup_text_highlight_finalize (GObject *object)
+{
+ EMailDisplayPopupTextHighlight *extension;
+
+ extension = E_MAIL_DISPLAY_POPUP_TEXT_HIGHLIGHT (object);
+
+ g_clear_object (&extension->action_group);
+ g_free (extension->document_uri);
+
+ /* Chain up to parent's method */
+ G_OBJECT_CLASS (e_mail_display_popup_text_highlight_parent_class)->finalize (object);
+}
+
void
e_mail_display_popup_text_highlight_type_register (GTypeModule *type_module)
{
@@ -336,12 +350,16 @@ e_mail_display_popup_text_highlight_type_register (GTypeModule *type_module)
static void
e_mail_display_popup_text_highlight_class_init (EMailDisplayPopupTextHighlightClass *klass)
{
+ GObjectClass *object_class;
EExtensionClass *extension_class;
e_mail_display_popup_text_highlight_parent_class = g_type_class_peek_parent (klass);
extension_class = E_EXTENSION_CLASS (klass);
extension_class->extensible_type = E_TYPE_MAIL_DISPLAY;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = e_mail_display_popup_text_highlight_finalize;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]