shithub: sce

Download patch

ref: d2e82dee94817cd37ea2fa08b8000cd7ee706430
parent: 97f65643a737ca5c7e6e68bc5efcb979fd1a1160
author: qwx <[email protected]>
date: Sat Apr 24 06:18:54 EDT 2021

fs: fix reading freed memory

--- a/fs.c
+++ b/fs.c
@@ -80,6 +80,7 @@
 	pic->h = dy;
 	pic->dx = i->r.min.x;
 	pic->dy = i->r.min.y;
+	m = i->depth / 8;
 	freeimage(i);
 	s = b;
 	while(n-- > 0){
@@ -89,7 +90,7 @@
 		else if(v != bgcol)
 			v |= 0xff << 24;
 		*p++ = v;
-		s += i->depth / 8;
+		s += m;
 	}
 	free(b);
 }