shithub: qk1

Download patch

ref: f870bc6589f353a45af7c24df73fa43346161aec
parent: b92b18d15ebabc0879641d758b3c3e2c081bdf71
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Nov 25 15:22:42 EST 2023

zone: fix a few analyzer warnings

--- a/zone.c
+++ b/zone.c
@@ -39,7 +39,7 @@
 		if((void*)(n+1) == p)
 			break;
 	}
-	assert((void*)(n+1) == p);
+	assert(n != nil && (void*)(n+1) == p);
 	data = Cache_Alloc(c, size);
 
 	hunk_head = n->next;
@@ -118,8 +118,9 @@
 Hunk_TempAlloc(int size)
 {
 	static void	*buf;
-	static int bufsz;
+	static int bufsz = -1;
 
+	assert(size >= 0);
 	if(size > bufsz){
 		buf = realloc(buf, size);
 		if(buf == nil)