shithub: qk1

Download patch

ref: 4219f692b155bf650c0918bffbbfa8d41dd670b6
parent: 774702b72beca0424f7998754e2f258dbb7086a6
author: Konstantinn Bonnet <[email protected]>
date: Thu Mar 12 08:44:46 EDT 2015

fix occasional double free on abnormal exit

... when heapsize is too small, and VID_Shutdown is called before framebuf is allocated.

--- a/README
+++ b/README
@@ -12,9 +12,9 @@
 	- cdaudio, networking: PORTME
 	- high resolutions work up to 4096x4096 (arbitrary limit in r_shared.h)
 		. by default, quake uses a 8MB heap, which will be insufficient for higher
-		resolutions → crash/exit with "Hunk_Alloc: failed on ..."
+		resolutions → exits with a related error message (not a note)
 			→ use [-mem MB], e.g.:
-			; quake -mem 24
+			; quake -mem 16
 		. resolutions under around 328x160 don't work, possibly because
 		menu text isn't scaled down, or something
 	- mouse is grabbed using m_windowed cvar
--- a/vid_9.c
+++ b/vid_9.c
@@ -104,7 +104,7 @@
 			}while(--n > 0);
 		}
 		//for(xi = x+width-1; xi >= x; xi--)
-		//	dest[xi] = st2d_8to16table[src[xi]];
+		//	dest[xi] = st2d_8to24table[src[xi]];
 	}
 }
 
@@ -111,8 +111,10 @@
 /* vid.height and vid.width must be set correctly before this call */
 void ResetFrameBuffer (void)
 {
-	if(framebuf != nil)
+	if(framebuf != nil){
 		free(framebuf);
+		framebuf = nil;
+	}
 
 	if(d_pzbuffer){
 		D_FlushCaches();