Prevent use after free of lump name in WAD compression-handling code.

Located by my new compiler! Also a nice, simple test commit for my new Git client...
This commit is contained in:
toaster 2022-07-16 12:51:22 +01:00
parent cd3774932e
commit b30e84b156

View file

@ -611,8 +611,6 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
lump_p->name2 = Z_Calloc(zentry->namelen + 1, PU_STATIC, NULL); lump_p->name2 = Z_Calloc(zentry->namelen + 1, PU_STATIC, NULL);
strncpy(lump_p->name2, fullname, zentry->namelen); strncpy(lump_p->name2, fullname, zentry->namelen);
free(fullname);
switch(zentry->compression) switch(zentry->compression)
{ {
case 0: case 0:
@ -631,6 +629,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
lump_p->compression = CM_UNSUPPORTED; lump_p->compression = CM_UNSUPPORTED;
break; break;
} }
free(fullname);
} }
*nlmp = numlumps; *nlmp = numlumps;