From: Felix Fietkau Date: Wed, 30 Jan 2008 02:14:49 +0000 (+0100) Subject: plug a memleak X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=commitdiff_plain;h=52d873161248b1160596ee8ca91b2e6fd315fc18 plug a memleak --- diff --git a/list.c b/list.c index 18de500..bd70857 100644 --- 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); }