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 4f1a794065
commit 9b7ff4d663

View file

@ -756,8 +756,10 @@ 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); uLong ccrc = crc32(crc32(0L, Z_NULL, 0), rdata, (uInt)usize);
if(ccrc != zcrc) if(ccrc != zcrc) {
free(rdata);
return -1; return -1;
}
} }
ret = load_twosf_map(state, issave, rdata, (unsigned)usize); ret = load_twosf_map(state, issave, rdata, (unsigned)usize);