summaryrefslogtreecommitdiff
path: root/SAX2.c
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2017-04-05 10:22:40 +0200
committerDaniel Veillard <veillard@redhat.com>2017-04-07 18:24:52 +0200
commit074180119fc90d5fd04ef9e8a5ee1910d6f9ad8e (patch)
tree8a04a7a3d291649360636e2df16c9fb354d2be46 /SAX2.c
parent90ccb58242866b0ba3edbef8fe44214a101c2b3e (diff)
downloadlibxml2-074180119fc90d5fd04ef9e8a5ee1910d6f9ad8e.tar.gz
Do not leak the new CData node if adding fails
For https://bugzilla.gnome.org/show_bug.cgi?id=780918
Diffstat (limited to 'SAX2.c')
-rw-r--r--SAX2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/SAX2.c b/SAX2.c
index 5cbb700a..0f0ad2a4 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -2805,7 +2805,8 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
xmlTextConcat(lastChild, value, len);
} else {
ret = xmlNewCDataBlock(ctxt->myDoc, value, len);
- xmlAddChild(ctxt->node, ret);
+ if (xmlAddChild(ctxt->node, ret) == NULL)
+ xmlFreeNode(ret);
}
}