[evolution/wip/webkit2] EHTMLEditorView - Fix leaks discovered by Valgrind



commit ab4549779476c655ee89caa9f49026d8378e7cd3
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Feb 26 10:43:36 2016 +0100

    EHTMLEditorView - Fix leaks discovered by Valgrind

 e-util/e-html-editor-view.c                        |    6 ++++++
 .../composer/e-html-editor-undo-redo-manager.c     |    6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 56b607c..07ef5df 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -1522,6 +1522,12 @@ html_editor_view_load_changed_cb (EHTMLEditorView *view,
                        op->data_free_func (op->data);
                g_free (op);
 
+               while ((op = g_queue_pop_head (view->priv->post_reload_operations))) {
+                       if (op->data_free_func)
+                               op->data_free_func (op->data);
+                       g_free (op);
+               }
+
                g_queue_clear (view->priv->post_reload_operations);
 
                return;
diff --git a/web-extensions/composer/e-html-editor-undo-redo-manager.c 
b/web-extensions/composer/e-html-editor-undo-redo-manager.c
index 55d5010..3f5f8f2 100644
--- a/web-extensions/composer/e-html-editor-undo-redo-manager.c
+++ b/web-extensions/composer/e-html-editor-undo-redo-manager.c
@@ -1822,7 +1822,7 @@ free_history_event_content (EHTMLEditorHistoryEvent *event)
                case HISTORY_REMOVE_LINK:
                case HISTORY_BLOCKQUOTE:
                        if (event->data.fragment != NULL)
-                               g_object_unref (event->data.fragment);
+                               g_clear_object (&event->data.fragment);
                        break;
                case HISTORY_FONT_COLOR:
                case HISTORY_PASTE:
@@ -1845,9 +1845,9 @@ free_history_event_content (EHTMLEditorHistoryEvent *event)
                case HISTORY_UNQUOTE:
                case HISTORY_LINK_DIALOG:
                        if (event->data.dom.from != NULL)
-                               g_object_unref (event->data.dom.from);
+                               g_clear_object (&event->data.dom.from);
                        if (event->data.dom.to != NULL)
-                               g_object_unref (event->data.dom.to);
+                               g_clear_object (&event->data.dom.to);
                        break;
                default:
                        break;


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