Closed lukasmacko closed 8 years ago
Hi, how did you come across this problem? If you create string leaves using our functions, you should never get NULL as the value.
Regards, Michal
Hi,
It is in one of our unit tests.
#include <stdio.h>
#include <stdlib.h>
#include <libyang/libyang.h>
int main(int argc, char **argv)
{
struct ly_ctx *ctx = ly_ctx_new(".");
const struct lys_module *module = ly_ctx_load_module(ctx, "test-module", NULL);
if (NULL == module) {
return 4;
}
struct lyd_node *node = lyd_new_path(NULL, ctx, "/test-module:main/string", "abc", 0);
node = lyd_new_path(node, ctx, "/test-module:main/string", NULL, LYD_PATH_OPT_UPDATE);
lyd_free_withsiblings(node);
ly_ctx_destroy(ctx, NULL);
return 0;
}
Regards, Lukas
Hi, you are right, I introduced this issue yesterday. It should be fixed now, but your example code (correctly) leaks memory, if you use it somewhere directly.
Regards, Michal
Hi,
thanks. The code is just a snippet to reproduce the bug, in the test memory is freed correctly.
Regrards, Lukas
Libyang crashes when the value of existing string leaf is set to
NULL