aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkummermehr <thorsten.kummermehr@k2l.de>2017-07-14 11:32:51 +0200
committertkummermehr <thorsten.kummermehr@k2l.de>2017-07-14 11:32:51 +0200
commit6783b8af64ba46b71607be62ae37db6e8a3a2b2e (patch)
tree03aea855bc092e2a9169a041c3b79f392b2a497f
parentef066e237377c7bca95cfa6e9735b5f81bcb9b86 (diff)
Fixed segmentation fault on faulty XML
-rw-r--r--ucs2-interface/ucs-xml/UcsXml.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ucs2-interface/ucs-xml/UcsXml.c b/ucs2-interface/ucs-xml/UcsXml.c
index 96498ef..f953fe3 100644
--- a/ucs2-interface/ucs-xml/UcsXml.c
+++ b/ucs2-interface/ucs-xml/UcsXml.c
@@ -266,7 +266,7 @@ static ParseResult_t ParseRoutes(UcsXmlVal_t *ucs, PrivateData_t *priv);
UcsXmlVal_t *UcsXml_Parse(const char *xmlString)
{
- UcsXmlVal_t *val;
+ UcsXmlVal_t *val = NULL;
ParseResult_t result = Parse_MemoryError;
mxml_node_t *tree;
if (!(tree = mxmlLoadString(NULL, xmlString, MXML_NO_CALLBACK))) goto ERROR;
@@ -287,7 +287,8 @@ ERROR:
assert(false);
if (!tree)
mxmlDelete(tree);
- FreeVal(val);
+ if (val)
+ FreeVal(val);
return NULL;
}