From 8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff Mon Sep 17 00:00:00 2001 From: rodri Date: Wed, 3 Apr 2024 18:31:40 +0000 Subject: scene: correct blatant use-after-free. --- scene.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scene.c b/scene.c index ec1d236..0984023 100644 --- a/scene.c +++ b/scene.c @@ -201,9 +201,10 @@ delscene(Scene *s) void clearscene(Scene *s) { - Entity *e; + Entity *e, *ne; - for(e = s->ents.next; e != &s->ents; e = e->next){ + for(e = s->ents.next; e != &s->ents; e = ne){ + ne = e->next; s->delent(s, e); delentity(e); } -- cgit v1.2.3