From 074180119fc90d5fd04ef9e8a5ee1910d6f9ad8e Mon Sep 17 00:00:00 2001 From: David Tardon Date: Wed, 5 Apr 2017 10:22:40 +0200 Subject: Do not leak the new CData node if adding fails For https://bugzilla.gnome.org/show_bug.cgi?id=780918 --- SAX2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'SAX2.c') 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); } } -- cgit v1.2.1