From be894e3e60349bded83599b07f92d4f1949e3753 Mon Sep 17 00:00:00 2001 From: Carl Smith Date: Wed, 9 Oct 2024 09:02:53 +1300 Subject: [PATCH] Use actual child being processed when traversing leaf list Previous code was using the parents first child which may not have been the child we are currently processing --- schema.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schema.c b/schema.c index 842e167..c9dd81b 100644 --- a/schema.c +++ b/schema.c @@ -3392,10 +3392,10 @@ _sch_traverse_nodes (sch_instance * instance, sch_node * schema, GNode * parent, { if (!(flags & SCH_F_FILTER_RDEPTH) || (depth >= rdepth)) { - for (GNode *child = parent->children->children; child; child = child->next) + for (GNode *leaf = child->children; leaf; leaf = leaf->next) { - free (child->children->data); - child->children->data = g_strdup (""); + free (leaf->children->data); + leaf->children->data = g_strdup (""); } } }