From a3c3749b98650b01d27d235cd6fd942f9919cd46 Mon Sep 17 00:00:00 2001 From: sezero Date: Fri, 31 Dec 2010 09:05:44 +0000 Subject: [PATCH] Mod_LoadLighting: free the allocated hunk memory in case of broken or unsupported lit file. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@360 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/gl_model.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Quake/gl_model.c b/Quake/gl_model.c index 62b0351e..88e57ddc 100644 --- a/Quake/gl_model.c +++ b/Quake/gl_model.c @@ -630,7 +630,7 @@ Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc */ void Mod_LoadLighting (lump_t *l) { - int i; + int i, mark; byte *in, *out, *data; byte d; char litfilename[1024]; @@ -639,6 +639,7 @@ void Mod_LoadLighting (lump_t *l) strcpy(litfilename, loadmodel->name); COM_StripExtension(litfilename, litfilename); strcat(litfilename, ".lit"); + mark = Hunk_LowMark(); data = (byte*) COM_LoadHunkFile (litfilename); if (data) { @@ -652,10 +653,16 @@ void Mod_LoadLighting (lump_t *l) return; } else + { + Hunk_FreeToLowMark(mark); Con_Printf("Unknown .lit file version (%d)\n", i); + } } else + { + Hunk_FreeToLowMark(mark); Con_Printf("Corrupt .lit file (old version?), ignoring\n"); + } } // LordHavoc: no .lit found, expand the white lighting data to color if (!l->filelen)