tree data BUGFIX freed node access
diff --git a/src/tree_data_free.c b/src/tree_data_free.c
index cf6527c..1c0521d 100644
--- a/src/tree_data_free.c
+++ b/src/tree_data_free.c
@@ -229,7 +229,7 @@
LY_LIST_FOR_SAFE(node, next, iter) {
if (lysc_is_key(iter->schema) && iter->parent) {
- LOGERR(LYD_CTX(node), LY_EINVAL, "Cannot free a list key \"%s\", free the list instance instead.", LYD_NAME(iter));
+ LOGERR(LYD_CTX(iter), LY_EINVAL, "Cannot free a list key \"%s\", free the list instance instead.", LYD_NAME(iter));
return;
}