From 52d873161248b1160596ee8ca91b2e6fd315fc18 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 30 Jan 2008 03:14:49 +0100 Subject: [PATCH] plug a memleak --- list.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.25.1