[evolution/wip/webkit2] Fix few memory leaks from webkit_dom_element_get_attribute() calls
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Fix few memory leaks from webkit_dom_element_get_attribute() calls
- Date: Wed, 7 Oct 2015 07:31:53 +0000 (UTC)
commit b4c5b30cd1a078502c228fdf37f0450b76453581
Author: Tomas Popela <tpopela redhat com>
Date: Tue May 12 13:29:21 2015 +0200
Fix few memory leaks from webkit_dom_element_get_attribute() calls
web-extensions/e-html-editor-view-dom-functions.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/web-extensions/e-html-editor-view-dom-functions.c
b/web-extensions/e-html-editor-view-dom-functions.c
index dbbc229..caca0da 100644
--- a/web-extensions/e-html-editor-view-dom-functions.c
+++ b/web-extensions/e-html-editor-view-dom-functions.c
@@ -414,7 +414,7 @@ dom_force_spell_check (WebKitDOMDocument *document,
gboolean
dom_node_is_citation_node (WebKitDOMNode *node)
{
- char *value;
+ gchar *value;
if (!WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (node))
return FALSE;
@@ -6493,7 +6493,7 @@ set_base64_to_element_attribute (GHashTable *inline_images,
attribute_value = webkit_dom_element_get_attribute (element, attribute);
- if ((base64_src = g_hash_table_lookup (inline_images, attribute_value)) != NULL) {
+ if (attribute_value && (base64_src = g_hash_table_lookup (inline_images, attribute_value)) != NULL) {
const gchar *base64_data = strstr (base64_src, ";") + 1;
gchar *name;
glong name_length;
@@ -6509,6 +6509,7 @@ set_base64_to_element_attribute (GHashTable *inline_images,
g_free (name);
}
+ g_free (attribute_value);
}
static void
@@ -6590,6 +6591,7 @@ dom_process_content_after_load (WebKitDOMDocument *document,
{
WebKitDOMHTMLElement *body;
WebKitDOMDOMWindow *dom_window;
+ gchar *data_evo_draft;
/* Don't use CSS when possible to preserve compatibility with older
* versions of Evolution or other MUAs */
@@ -6620,13 +6622,16 @@ dom_process_content_after_load (WebKitDOMDocument *document,
move_elements_to_body (document);
repair_gmail_blockquotes (document);
- if (webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (body), "data-evo-draft")) {
+ data_evo_draft = webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (body), "data-evo-draft");
+ if (data_evo_draft) {
/* Restore the selection how it was when the draft was saved */
dom_move_caret_into_element (document, WEBKIT_DOM_ELEMENT (body), FALSE);
dom_selection_restore (document);
dom_remove_embed_style_sheet (document);
}
+ g_free (data_evo_draft);
+
/* The composer body could be empty in some case (loading an empty string
* or empty HTML. In that case create the initial paragraph. */
if (!webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (body))) {
@@ -7548,6 +7553,7 @@ rename_attribute (WebKitDOMElement *element,
if (value)
webkit_dom_element_set_attribute (element, to, value, NULL);
webkit_dom_element_remove_attribute (element, from);
+ g_free (value);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]