If a new section with the same name and type of an old one is found, a
memory reallocation happens. Still, the options list for the section is
not reinitialized, hence a stale pointer is being used.

Signed-off-by: Enrico Mioso <mrkiko...@gmail.com>
---
 list.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/list.c b/list.c
index 25aec56..d934216 100644
--- a/list.c
+++ b/list.c
@@ -717,6 +717,7 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
                        ptr->last = uci_realloc(ctx, ptr->s, sizeof(struct 
uci_section));
                        ptr->s = uci_to_section(ptr->last);
                        uci_list_fixup(&ptr->s->e.list);
+                       uci_list_init(&ptr->s->options);
                } else {
                        free(ptr->s->type);
                }
-- 
2.18.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to