Skip to content

Commit

Permalink
data tree BUGFIX memory leak
Browse files Browse the repository at this point in the history
Fixes #16
  • Loading branch information
rkrejci authored and PavolVican committed Feb 9, 2016
1 parent 3cf607d commit d1d82ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tree_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
static struct lyd_node *
lyd_parse_(struct ly_ctx *ctx, const struct lys_node *parent, const char *data, LYD_FORMAT format, int options)
{
struct lyxml_elem *xml;
struct lyxml_elem *xml, *xmlnext;
struct lyd_node *result = NULL;
int xmlopt = LYXML_PARSE_MULTIROOT;

Expand All @@ -67,7 +67,9 @@ lyd_parse_(struct ly_ctx *ctx, const struct lys_node *parent, const char *data,
case LYD_XML_FORMAT:
xml = lyxml_parse_mem(ctx, data, xmlopt);
result = lyd_parse_xml(ctx, &xml, options, parent);
lyxml_free(ctx, xml);
LY_TREE_FOR_SAFE(xml, xmlnext, xml) {
lyxml_free(ctx, xml);
}
break;
case LYD_JSON:
result = lyd_parse_json(ctx, parent, data, options);
Expand Down

0 comments on commit d1d82ff

Please sign in to comment.