[evolution/wip-webkit2] Remove leaks in Evolution Web Extension



commit 84e2b1958ae2010f0ebe3f321b2c795b67781a69
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Oct 29 14:28:12 2013 +0100

    Remove leaks in Evolution Web Extension

 web-extensions/evolution-web-extension.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/web-extensions/evolution-web-extension.c b/web-extensions/evolution-web-extension.c
index 9b9de91..8f73d1e 100644
--- a/web-extensions/evolution-web-extension.c
+++ b/web-extensions/evolution-web-extension.c
@@ -151,7 +151,10 @@ handle_method_call (GDBusConnection *connection,
                document = webkit_web_page_get_dom_document (web_page);
                html_content = e_dom_utils_get_document_content_html (document);
 
-               g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", html_content));
+               g_dbus_method_invocation_return_value (
+                       invocation, g_variant_new ("(s)", html_content));
+
+               g_free (html_content);
        } else if (g_strcmp0 (method_name, "GetSelectionContentHtml") == 0) {
                gchar *html_content;
 
@@ -163,7 +166,10 @@ handle_method_call (GDBusConnection *connection,
                document = webkit_web_page_get_dom_document (web_page);
                html_content = e_dom_utils_get_selection_content_html (document);
 
-               g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", html_content));
+               g_dbus_method_invocation_return_value (invocation,
+                       g_variant_new ("(s)", html_content));
+
+               g_free (html_content);
        } else if (g_strcmp0 (method_name, "GetSelectionContentText") == 0) {
                gchar *text_content;
 
@@ -175,11 +181,18 @@ handle_method_call (GDBusConnection *connection,
                document = webkit_web_page_get_dom_document (web_page);
                text_content = e_dom_utils_get_selection_content_html (document);
 
-               g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", text_content));
+               g_dbus_method_invocation_return_value (invocation,
+                       g_variant_new ("(s)", text_content));
+
+               g_free (text_content);
        } else if (g_strcmp0 (method_name, "AddCSSRuleIntoStyleSheet") == 0) {
-               gchar *style_sheet_id, *selector, *style;
+               const gchar *style_sheet_id, *selector, *style;
+
+               g_variant_get (
+                       parameters,
+                       "(t&s&s&s)",
+                       &page_id, &style_sheet_id, &selector, &style);
 
-               g_variant_get (parameters, "(tsss)", &page_id, &style_sheet_id, &selector, &style);
                web_page = get_webkit_web_page_or_return_dbus_error (invocation, web_extension, page_id);
                if (!web_page)
                        return;
@@ -189,9 +202,9 @@ handle_method_call (GDBusConnection *connection,
 
                g_dbus_method_invocation_return_value (invocation, NULL);
        } else if (g_strcmp0 (method_name, "CreateAndAddCSSStyleSheet") == 0) {
-               gchar *style_sheet_id;
+               const gchar *style_sheet_id;
 
-               g_variant_get (parameters, "(ts)", &page_id, &style_sheet_id);
+               g_variant_get (parameters, "(t&s)", &page_id, &style_sheet_id);
                web_page = get_webkit_web_page_or_return_dbus_error (invocation, web_extension, page_id);
                if (!web_page)
                        return;


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