BUGFIX check return codes of asprintf() and chdir()
For some compilers these functions are defined with warn_unused_result
attribute and ignoring the return value generates compiler's warning
diff --git a/src/tree_data.c b/src/tree_data.c
index 7a3f69f..1b580e5 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -352,7 +352,11 @@
ret->prev = (struct lyd_node *)ret;
/* store the anyxml data together with the anyxml element */
- asprintf(&xml, "<%s>%s</%s>", schema->name, (val_xml ? val_xml : ""), schema->name);
+ if (asprintf(&xml, "<%s>%s</%s>", schema->name, (val_xml ? val_xml : ""), schema->name) == -1) {
+ LOGMEM;
+ lyd_free((struct lyd_node *)ret);
+ return NULL;
+ }
root = lyxml_parse_mem(schema->module->ctx, xml, 0);
free(xml);
if (!root) {