parser lyb BUGFIX proper XML prefix data parsing
Fixes #1798
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index 1399e12..43eafc1 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -498,9 +498,6 @@
case LY_VALUE_XML:
/* read count */
lyb_read(&count, 1, lybctx);
- if (!count) {
- return LY_SUCCESS;
- }
/* read all NS elements */
LY_CHECK_GOTO(ret = ly_set_new(&set), cleanup);
@@ -510,6 +507,10 @@
/* prefix */
LY_CHECK_GOTO(ret = lyb_read_string(&ns->prefix, sizeof(uint16_t), lybctx), cleanup);
+ if (!strlen(ns->prefix)) {
+ free(ns->prefix);
+ ns->prefix = NULL;
+ }
/* namespace */
LY_CHECK_GOTO(ret = lyb_read_string(&ns->uri, sizeof(uint16_t), lybctx), cleanup);