From 40090b397625b75307f85a4a8ca3e0dc0d3f7798 Mon Sep 17 00:00:00 2001 From: Radek Krejci Date: Wed, 10 Feb 2016 13:08:08 +0100 Subject: [PATCH] data parser BUGFIX handle retturn code of lyxml_parse_mem() detect error (not just empty data, real error) in XML parser and return immediately Fixes #21 --- src/tree_data.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tree_data.c b/src/tree_data.c index ff81c67cea..08503685fd 100644 --- a/src/tree_data.c +++ b/src/tree_data.c @@ -65,6 +65,9 @@ lyd_parse_(struct ly_ctx *ctx, const struct lys_node *parent, const char *data, case LYD_XML: case LYD_XML_FORMAT: xml = lyxml_parse_mem(ctx, data, xmlopt); + if (ly_errno) { + return NULL; + } result = lyd_parse_xml(ctx, &xml, options, parent); LY_TREE_FOR_SAFE(xml, xmlnext, xml) { lyxml_free(ctx, xml);