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
This commit is contained in:
sezero 2010-12-31 09:05:44 +00:00
parent 0926f39da2
commit a3c3749b98
1 changed files with 8 additions and 1 deletions

View File

@ -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,11 +653,17 @@ 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)
return;