mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-20 19:12:03 +00:00
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:
parent
0926f39da2
commit
a3c3749b98
1 changed files with 8 additions and 1 deletions
|
@ -630,7 +630,7 @@ Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc
|
||||||
*/
|
*/
|
||||||
void Mod_LoadLighting (lump_t *l)
|
void Mod_LoadLighting (lump_t *l)
|
||||||
{
|
{
|
||||||
int i;
|
int i, mark;
|
||||||
byte *in, *out, *data;
|
byte *in, *out, *data;
|
||||||
byte d;
|
byte d;
|
||||||
char litfilename[1024];
|
char litfilename[1024];
|
||||||
|
@ -639,6 +639,7 @@ void Mod_LoadLighting (lump_t *l)
|
||||||
strcpy(litfilename, loadmodel->name);
|
strcpy(litfilename, loadmodel->name);
|
||||||
COM_StripExtension(litfilename, litfilename);
|
COM_StripExtension(litfilename, litfilename);
|
||||||
strcat(litfilename, ".lit");
|
strcat(litfilename, ".lit");
|
||||||
|
mark = Hunk_LowMark();
|
||||||
data = (byte*) COM_LoadHunkFile (litfilename);
|
data = (byte*) COM_LoadHunkFile (litfilename);
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
@ -652,10 +653,16 @@ void Mod_LoadLighting (lump_t *l)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Hunk_FreeToLowMark(mark);
|
||||||
Con_Printf("Unknown .lit file version (%d)\n", i);
|
Con_Printf("Unknown .lit file version (%d)\n", i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Hunk_FreeToLowMark(mark);
|
||||||
Con_Printf("Corrupt .lit file (old version?), ignoring\n");
|
Con_Printf("Corrupt .lit file (old version?), ignoring\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// LordHavoc: no .lit found, expand the white lighting data to color
|
// LordHavoc: no .lit found, expand the white lighting data to color
|
||||||
if (!l->filelen)
|
if (!l->filelen)
|
||||||
|
|
Loading…
Reference in a new issue