plug a memleak
authorFelix Fietkau <nbd@openwrt.org>
Wed, 30 Jan 2008 02:14:49 +0000 (03:14 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 30 Jan 2008 02:14:49 +0000 (03:14 +0100)
list.c

diff --git a/list.c b/list.c
index 18de500445990ef167963357d4f55095aa435385..bd70857abdb1af2bc5e71748d327f95099e30bf9 100644 (file)
--- a/list.c
+++ b/list.c
@@ -102,6 +102,9 @@ uci_alloc_option(struct uci_section *s, const char *name, const char *value)
 static inline void
 uci_free_option(struct uci_option *o)
 {
+       if ((o->value != uci_dataptr(o)) &&
+               (o->value != NULL))
+               free(o->value);
        uci_free_element(&o->e);
 }
 
@@ -135,6 +138,9 @@ uci_free_section(struct uci_section *s)
        uci_foreach_element_safe(&s->options, tmp, o) {
                uci_free_option(uci_to_option(o));
        }
+       if ((s->type != uci_dataptr(s)) &&
+               (s->type != NULL))
+               free(s->type);
        uci_free_element(&s->e);
 }