From b30e84b15689a85338b3e8790cc0540ddc3c3a27 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 16 Jul 2022 12:51:22 +0100 Subject: [PATCH] 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... --- src/w_wad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 30769346..d8065b0f 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -611,8 +611,6 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) lump_p->name2 = Z_Calloc(zentry->namelen + 1, PU_STATIC, NULL); strncpy(lump_p->name2, fullname, zentry->namelen); - free(fullname); - switch(zentry->compression) { case 0: @@ -631,6 +629,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) lump_p->compression = CM_UNSUPPORTED; break; } + + free(fullname); } *nlmp = numlumps;