[evolution] Composer - Fix various leaks



commit a9e56e2591163051ddcf384117a4996a29335b9c
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 26 10:38:58 2015 +0100

    Composer - Fix various leaks

 composer/e-msg-composer.c        |    8 +++++---
 e-util/e-html-editor-selection.c |    7 ++++++-
 e-util/e-picture-gallery.c       |    2 ++
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index e7acb0d..54feb53 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1371,7 +1371,7 @@ composer_build_message (EMsgComposer *composer,
                gboolean pre_encode;
                EHTMLEditor *editor;
                EHTMLEditorView *view;
-               GList *inline_images;
+               GList *inline_images = NULL;
 
                editor = e_msg_composer_get_editor (composer);
                view = e_html_editor_get_view (editor);
@@ -1457,7 +1457,6 @@ composer_build_message (EMsgComposer *composer,
                                CamelMimePart *part = g_list_nth_data (inline_images, ii);
                                camel_multipart_add_part (
                                        html_with_images, part);
-                               g_object_unref (part);
                        }
 
                        context->top_level_part =
@@ -1466,6 +1465,7 @@ composer_build_message (EMsgComposer *composer,
                        context->top_level_part =
                                CAMEL_DATA_WRAPPER (body);
                }
+               g_list_free_full (inline_images, g_object_unref);
        }
 
        /* If there are attachments, wrap what we've built so far
@@ -1960,6 +1960,7 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
                do {
                        text = next_uri ((guchar **) &data, &len, &list_len);
                        e_html_editor_selection_insert_html (editor_selection, text);
+                       g_free (text);
                } while (list_len);
 
                e_html_editor_view_check_magic_links (html_editor_view, FALSE);
@@ -1995,6 +1996,7 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
                do {
                        uri = next_uri ((guchar **) &data, &len, &list_len);
                        e_html_editor_selection_insert_image (editor_selection, uri);
+                       g_free (uri);
                } while (list_len);
 
                gtk_drag_finish (context, TRUE, FALSE, time);
@@ -2017,8 +2019,8 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
                list_len = length;
                do {
                        uri = next_uri ((guchar **) &data, &len, &list_len);
-
                        e_html_editor_selection_insert_image (editor_selection, uri);
+                       g_free (uri);
                } while (list_len);
 
                gtk_drag_finish (context, TRUE, FALSE, time);
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 7e5c88f..8f987ed 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -2858,10 +2858,12 @@ e_html_editor_selection_get_font_color (EHTMLEditorSelection *selection,
                document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
                body = webkit_dom_document_get_body (document);
 
+               g_free (color);
                color = webkit_dom_html_body_element_get_text (WEBKIT_DOM_HTML_BODY_ELEMENT (body));
                if (!(color && *color)) {
                        *rgba = black;
                        g_object_unref (view);
+                       g_free (color);
                        return;
                }
        }
@@ -3013,8 +3015,10 @@ e_html_editor_selection_get_font_size (EHTMLEditorSelection *selection)
                E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL);
 
        size = get_font_property (selection, "size");
-       if (!(size && *size))
+       if (!(size && *size)) {
+               g_free (size);
                return E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL;
+       }
 
        size_int = atoi (size);
        g_free (size);
@@ -4416,6 +4420,7 @@ e_html_editor_selection_set_monospaced (EHTMLEditorSelection *selection,
                                g_object_unref (range);
                                g_object_unref (dom_selection);
                                g_object_unref (dom_window);
+                               g_free (ev);
                                return;
                        }
                }
diff --git a/e-util/e-picture-gallery.c b/e-util/e-picture-gallery.c
index 71e48e0..594f13b 100644
--- a/e-util/e-picture-gallery.c
+++ b/e-util/e-picture-gallery.c
@@ -393,6 +393,8 @@ picture_gallery_dispose (GObject *object)
                gallery->priv->monitor = NULL;
        }
 
+       g_free (gallery->priv->path);
+
        /* Chain up to parent's dispose() method. */
        G_OBJECT_CLASS (e_picture_gallery_parent_class)->dispose (object);
 }


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