From 2b86a11e49aa14d24c1e85ff5a7bd5ce58565df6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 21 Oct 2011 15:09:11 +0200 Subject: [PATCH] ucimap: fix use-after-free on cleanup (patch by Stanislav Fomichev) --- ucimap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } } -- 2.25.1