From b9500eaa5dae8a630892fe94415413f70bbfb92c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 21 Oct 2023 04:35:59 +0300 Subject: [PATCH 34/34] goto_unit_killed(): Fix use-after-free warning See osdn #48875 Signed-off-by: Marko Lindqvist --- client/goto.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/goto.c b/client/goto.c index e2e36e6aa0..928f316610 100644 --- a/client/goto.c +++ b/client/goto.c @@ -1049,11 +1049,9 @@ void goto_unit_killed(struct unit *punit) goto_map_unit_iterate(goto_maps, goto_map, ptest) { if (ptest == punit) { - goto_map_free(goto_map); - /* Still safe using goto_map pointer, as it is not used for - * dereferencing, only as value. */ goto_map_list_remove(goto_maps, goto_map); - /* stop now, links are gone! */ + goto_map_free(goto_map); + /* Stop now, links are gone! */ break; } } goto_map_unit_iterate_end; -- 2.42.0