From: Felix Fietkau Date: Fri, 21 Oct 2011 13:09:11 +0000 (+0200) Subject: ucimap: fix use-after-free on cleanup (patch by Stanislav Fomichev) X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2b86a11e49aa14d24c1e85ff5a7bd5ce58565df6;p=oweals%2Fuci.git ucimap: fix use-after-free on cleanup (patch by Stanislav Fomichev) --- diff --git a/ucimap.c b/ucimap.c index 140c684..16ce56a 100644 --- a/ucimap.c +++ b/ucimap.c @@ -162,9 +162,10 @@ ucimap_free_section(struct uci_map *map, struct ucimap_section_data *sd) void ucimap_cleanup(struct uci_map *map) { - struct ucimap_section_data *sd; + struct ucimap_section_data *sd, *sd_next; - for (sd = map->sdata; sd; sd = sd->next) { + for (sd = map->sdata; sd; sd = sd_next) { + sd_next = sd->next; ucimap_free_section(map, sd); } }