Merge branch 'stop-wuse-after-free' into 'master'

Stop -Wuse-after-free warnings

See merge request STJr/SRB2!1805
This commit is contained in:
sphere 2022-09-08 14:51:17 +00:00
commit 892ffbe01b
2 changed files with 3 additions and 3 deletions

View file

@ -712,9 +712,9 @@ lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders)
// Close any open directories and return if something went wrong.
if (failure)
{
for (; depthleft < maxdirdepth; closedir(dirhandle[depthleft++]));
free(dirpathindex);
free(dirhandle);
for (; depthleft < maxdirdepth; closedir(dirhandle[depthleft++]));
return NULL;
}

View file

@ -641,8 +641,6 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
lump_p->fullname = Z_Calloc(zentry.namelen + 1, PU_STATIC, NULL);
strncpy(lump_p->fullname, fullname, zentry.namelen);
free(fullname);
switch(zentry.compression)
{
case 0:
@ -662,6 +660,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
break;
}
free(fullname);
// skip and ignore comments/extra fields
if (fseek(handle, zentry.xtralen + zentry.commlen, SEEK_CUR) != 0)
{