summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-11-26 10:19:03 +0000
committerRichard Hughes <richard@hughsie.com>2016-11-26 10:19:03 +0000
commit6381fb7837f34e70eb62934c688f24d2f49b4f12 (patch)
tree08a454fe57f55efd02c0dba56eeca08a83d899d3
parentd156942f23b80137740c0781a14a9f05f5fe497c (diff)
downloadappstream-glib-6381fb7837f34e70eb62934c688f24d2f49b4f12.tar.gz
trivial: Fix a tiny memory leak when escaping cdata
-rw-r--r--libappstream-glib/as-node.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c
index 9277f81..23ad52d 100644
--- a/libappstream-glib/as-node.c
+++ b/libappstream-glib/as-node.c
@@ -271,9 +271,6 @@ as_node_cdata_to_raw (AsNodeData *data)
static void
as_node_cdata_to_escaped (AsNodeData *data)
{
- GString *str;
- g_autofree gchar *tmp = NULL;
-
if (data->is_root_node)
return;
if (data->is_cdata_escaped)
@@ -281,7 +278,7 @@ as_node_cdata_to_escaped (AsNodeData *data)
if (g_strstr_len (data->cdata, -1, "&") != NULL ||
g_strstr_len (data->cdata, -1, "<") != NULL ||
g_strstr_len (data->cdata, -1, ">") != NULL) {
- str = g_string_new (data->cdata);
+ g_autoptr(GString) str = g_string_new (data->cdata);
as_ref_string_unref (data->cdata);
as_utils_string_replace (str, "&", "&amp;");
as_utils_string_replace (str, "<", "&lt;");