summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-04-03 18:31:40 +0000
committerrodri <rgl@antares-labs.eu>2024-04-03 18:31:40 +0000
commit8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff (patch)
tree2487da17ea8db86d6cac2cf0bf7e5d5b7fa2e480
parentd986df6a1511d9b8e80d060e39aa86600e0a281f (diff)
downloadlibgraphics-8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff.tar.gz
libgraphics-8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff.tar.bz2
libgraphics-8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff.zip
scene: correct blatant use-after-free.
-rw-r--r--scene.c5
1 files 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);
}