shithub: libgraphics

Download patch

ref: 8b5ba54275a75b71cb5a7c523cf089e4f6ed7fff
parent: d986df6a1511d9b8e80d060e39aa86600e0a281f
author: rodri <rgl@antares-labs.eu>
date: Wed Apr 3 14:31:40 EDT 2024

scene: correct blatant use-after-free.

--- a/scene.c
+++ b/scene.c
@@ -201,9 +201,10 @@
 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);
 	}