Bug Fix: Fix potential memory leak

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-06-24 03:49:42 -07:00
parent b5a999999a
commit 6c6971a530

View file

@ -756,9 +756,11 @@ static int load_twosf_mapz(struct twosf_loader_state *state, int issave, const u
{
uLong ccrc = crc32(crc32(0L, Z_NULL, 0), rdata, (uInt)usize);
if(ccrc != zcrc)
if(ccrc != zcrc) {
free(rdata);
return -1;
}
}
ret = load_twosf_map(state, issave, rdata, (unsigned)usize);
free(rdata);