From f8dbe32d7baa8ca2b12b5ee9def171018c2f9d98 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Nov 2015 10:22:51 +0800 Subject: [PATCH 1/2] parser_yin BUGFIX when adding the same module, after free the loading module, the 'ctx->models.list[i]' is change, not exist module yet --- src/parser_yin.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/parser_yin.c b/src/parser_yin.c index d20929f8d..73e9b38f3 100644 --- a/src/parser_yin.c +++ b/src/parser_yin.c @@ -5056,6 +5056,7 @@ yin_read_module(struct ly_ctx *ctx, const char *data, int implement, struct unre { struct lyxml_elem *yin; struct lys_module *module = NULL, **newlist = NULL; + struct lys_module *existmod = NULL; const char *value; int i; @@ -5113,15 +5114,16 @@ yin_read_module(struct ly_ctx *ctx, const char *data, int implement, struct unre /* both have the same revision -> we already have the same module */ /* so free the new one and update the old one's implement flag if needed */ lyxml_free_elem(ctx, yin); + existmod = ctx->models.list[i]; lys_free(module, 0); unres->count = 0; - LOGVRB("Module %s already in context", ctx->models.list[i]->name); + LOGVRB("Module %s already in context", existmod->name); - if (implement && !ctx->models.list[i]->implemented) { - lyp_set_implemented(ctx->models.list[i]); + if (implement && !existmod->implemented) { + lyp_set_implemented(existmod); } - return ctx->models.list[i]; + return existmod; } } /* else (both elses) keep searching, for now the caller is just adding From 2a17a4ebe0730bb24423e07665fbb4b99d11e0bc Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Nov 2015 10:26:09 +0800 Subject: [PATCH 2/2] parser_yin BUGFIX when adding the same module, after free the loading module, the 'ctx->models.list[i]' is change, not exist module yet --- src/parser_yin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser_yin.c b/src/parser_yin.c index 73e9b38f3..e18a92e74 100644 --- a/src/parser_yin.c +++ b/src/parser_yin.c @@ -5056,7 +5056,7 @@ yin_read_module(struct ly_ctx *ctx, const char *data, int implement, struct unre { struct lyxml_elem *yin; struct lys_module *module = NULL, **newlist = NULL; - struct lys_module *existmod = NULL; + struct lys_module *existmod = NULL; const char *value; int i;