[evolution/wip/webkit2] Composer - Fix various leaks



commit 7b06207e09a2c8939248bf844889ba75e0454cf8
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Nov 10 15:20:52 2015 +0100

    Composer - Fix various leaks

 composer/e-msg-composer.c                          |    8 +++++---
 e-util/e-picture-gallery.c                         |    2 ++
 .../e-html-editor-selection-dom-functions.c        |   10 ++++++++--
 3 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index c7e76cd..457b944 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1369,7 +1369,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);
@@ -1455,7 +1455,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 =
@@ -1464,6 +1463,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
@@ -1956,6 +1956,7 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
                do {
                        text = next_uri ((guchar **) &data, &len, &list_len);
                        e_html_editor_view_insert_html (view, text);
+                       g_free (text);
                } while (list_len);
 
                e_html_editor_view_check_magic_links (view);
@@ -1991,6 +1992,7 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
                do {
                        uri = next_uri ((guchar **) &data, &len, &list_len);
                        e_html_editor_view_insert_image (view, uri);
+                       g_free (uri);
                } while (list_len);
 
                gtk_drag_finish (context, TRUE, FALSE, time);
@@ -2013,8 +2015,8 @@ msg_composer_drag_data_received_cb (GtkWidget *widget,
                list_len = length;
                do {
                        uri = next_uri ((guchar **) &data, &len, &list_len);
-
                        e_html_editor_view_insert_image (view, uri);
+                       g_free (uri);
                } while (list_len);
 
                gtk_drag_finish (context, TRUE, FALSE, time);
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);
 }
diff --git a/web-extensions/composer/e-html-editor-selection-dom-functions.c 
b/web-extensions/composer/e-html-editor-selection-dom-functions.c
index ce7aaaa..b7e0c16 100644
--- a/web-extensions/composer/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -3447,6 +3447,7 @@ dom_selection_set_monospaced (WebKitDOMDocument *document,
                                g_object_unref (range);
                                g_object_unref (dom_selection);
                                g_object_unref (dom_window);
+                               g_free (ev);
                                return;
                        }
                }
@@ -3889,8 +3890,10 @@ dom_selection_get_font_size (WebKitDOMDocument *document,
        guint size_int;
 
        size = get_font_property (document, "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);
@@ -4107,9 +4110,12 @@ dom_selection_get_font_color (WebKitDOMDocument *document,
                WebKitDOMHTMLElement *body;
 
                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))
+               if (!(color && *color)) {
+                       g_free (color);
                        return g_strdup ("#000000");
+               }
        }
 
        return color;


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