pyapi BUGFIX double free
The data managed by libyang python API were freed directly by
libnetconf's python binding code.
diff --git a/python/rpc.c b/python/rpc.c
index 79ca2ba..ecf75d2 100644
--- a/python/rpc.c
+++ b/python/rpc.c
@@ -269,7 +269,8 @@
node = lyd_new_leaf(data, ietfnc, "url", content_str);
}
} else if (content_tree) {
- node = lyd_new_anydata(data, ietfnc, "config", content_tree, LYD_ANYDATA_DATATREE);
+ /* the content_tree is managed by libyang, make copy to insert it into RPC and manage it on our own */
+ node = lyd_new_anydata(data, ietfnc, "config", lyd_dup_withsiblings(content_tree, LYD_DUP_OPT_RECURSIVE), LYD_ANYDATA_DATATREE);
}
if (!node) {
goto error;