Skip to content

Commit b9cbb47

Browse files
committed
parser json BUGFIX proper module name and its length return
Fixes #2029
1 parent 84bf6f4 commit b9cbb47

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/parser_json.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,24 @@ lydjson_get_node_prefix(struct lyd_node *node, const char *local_prefix, size_t
161161
return LY_SUCCESS;
162162
}
163163

164-
*prefix_p = NULL;
165164
while (node) {
166165
if (node->schema) {
167-
*prefix_p = node->schema->module->name;
166+
module_name = node->schema->module->name;
168167
break;
169168
}
170169
onode = (struct lyd_node_opaq *)node;
171170
if (onode->name.module_name) {
172-
*prefix_p = onode->name.module_name;
171+
module_name = onode->name.module_name;
173172
break;
174173
} else if (onode->name.prefix) {
175-
*prefix_p = onode->name.prefix;
174+
module_name = onode->name.prefix;
176175
break;
177176
}
178177
node = lyd_parent(node);
179178
}
180-
*prefix_len_p = ly_strlen(module_name);
181179

180+
*prefix_p = module_name;
181+
*prefix_len_p = ly_strlen(module_name);
182182
return LY_SUCCESS;
183183
}
184184

0 commit comments

Comments
 (0)