Fix a number of cases where files opened with cache1d.cpp's kopen_internal() could be leaked.

git-svn-id: https://svn.eduke32.com/eduke32@6570 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2017-12-18 23:36:05 +00:00
parent d9b0479343
commit 741305e976
6 changed files with 16 additions and 0 deletions

View file

@ -678,7 +678,10 @@ static int32_t defsparser(scriptfile *script)
artheader_t local;
int32_t headerval = E_ReadArtFileHeader(fil, fn, &local);
if (headerval != 0)
{
kclose(fil);
break;
}
if (havetile)
{

View file

@ -9134,7 +9134,10 @@ int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daan
{ mapversion = 7; return -1; }
if (kread(fil, &mapversion, 4) != 4)
{
kclose(fil);
return -2;
}
{
int32_t ok = 0;

View file

@ -73,7 +73,10 @@ static int32_t read_whole_file(const char *fn, char **retbufptr)
flen = kfilelength(fid);
if (flen == 0)
{
kclose(fid);
return 5;
}
buf = (char *)Xmalloc(flen+1);

View file

@ -440,7 +440,10 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei)
artheader_t local;
int const headerval = E_ReadArtFileHeader(fil, fn, &local);
if (headerval != 0)
{
kclose(fil);
return headerval;
}
if (permap)
{

View file

@ -295,6 +295,7 @@ int32_t Anim_Play(const char *fn)
{
OSD_Printf("Error initializing VPX codec.\n");
animvpx_restore_glstate();
kclose(handle);
return 0;
}

View file

@ -166,7 +166,10 @@ static void ReadSaveGameHeaders_CACHE1D(CACHE1D_FIND_REC *f)
if (k > 0)
msv.isOldVer = 1;
else
{
kclose(fil);
continue;
}
// else h.savename is all zeros (fatal failure, like wrong header
// magic or too short header)
}