Skip to content

Commit

Permalink
data parser BUGFIX handle retturn code of lyxml_parse_mem()
Browse files Browse the repository at this point in the history
detect error (not just empty data, real error) in XML parser and return
immediately

Fixes #21
  • Loading branch information
rkrejci authored and PavolVican committed Feb 21, 2016
1 parent 1a4654d commit 40090b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tree_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 40090b3

Please sign in to comment.