From dcd4995eb3ca9812a0ede191d4b55f48c8c37578 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 22 Jun 2019 00:19:34 +0100 Subject: [PATCH 1/2] Remember to end inflating --- src/w_wad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 5bf7a36d3..4d7d930b6 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1327,8 +1327,9 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si { size = 0; zerr(zErr); - (void)inflateEnd(&strm); } + + (void)inflateEnd(&strm); } else { From 8444379d5357ebed6bb30aca0cb2e804128f399a Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 22 Jun 2019 00:52:28 +0100 Subject: [PATCH 2/2] Free the zentries --- src/w_wad.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 6ed2d50c2..8d96449f1 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -565,14 +565,14 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) { CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle))); Z_Free(lumpinfo); - free(zentry); + free(zentries); return NULL; } if (memcmp(zentry->signature, pat_central, 4)) { CONS_Alert(CONS_ERROR, "Central directory is corrupt\n"); Z_Free(lumpinfo); - free(zentry); + free(zentries); return NULL; } @@ -585,7 +585,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) { CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle))); Z_Free(lumpinfo); - free(zentry); + free(zentries); free(fullname); return NULL; } @@ -627,6 +627,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) } } + free(zentries); + *nlmp = numlumps; return lumpinfo; }