[evolution] Fix few memory leaks when converting composer text to plain text
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Fix few memory leaks when converting composer text to plain text
- Date: Wed, 11 Jan 2017 16:02:11 +0000 (UTC)
commit 316c6054e91475ffc8c720cdd779f1df8440fe00
Author: Milan Crha <mcrha redhat com>
Date: Wed Jan 11 17:02:29 2017 +0100
Fix few memory leaks when converting composer text to plain text
.../web-extension/e-editor-dom-functions.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 313244b..9c0a13c 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -7196,11 +7196,14 @@ process_node_to_plain_text_for_exporting (EEditorPage *editor_page,
GRegex *regex;
content = webkit_dom_node_get_text_content (child);
+ if (!content)
+ goto next;
+
/* The text nodes with only '\n' are reflected only in
* PRE elements, otherwise skip them. */
/* FIXME wrong for "white-space: pre", but we don't use
* that in editor in our expected DOM structure */
- if (strlen (content) == 1 && *content == '\n' &&
+ if (content[0] == '\n' && content[1] == '\0' &&
!WEBKIT_DOM_IS_HTML_PRE_ELEMENT (source)) {
g_free (content);
skip_node = TRUE;
@@ -7263,6 +7266,9 @@ process_node_to_plain_text_for_exporting (EEditorPage *editor_page,
g_string_append (buffer, content);
+ g_free (content);
+ content = NULL;
+
goto next;
}
@@ -7449,6 +7455,7 @@ process_node_to_html_for_exporting (EEditorPage *editor_page,
NULL);
remove_node (node);
+ g_free (text_content);
}
g_clear_object (&collection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]