Core: Fix memory leak loading ELF files

This commit is contained in:
Vicki Pfau 2020-08-17 01:00:36 -07:00
parent f4522c3942
commit 343812e9e6
2 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,7 @@ Other fixes:
- All: Improve export headers (fixes mgba.io/i/1738)
- Core: Ensure ELF regions can be written before trying
- Core: Fix reported ROM size when a fixed buffer size is used
- Core: Fix memory leak loading ELF files
- Debugger: Don't skip undefined instructions when debugger attached
- FFmpeg: Fix some small memory leaks
- FFmpeg: Fix encoding of time base

View File

@ -387,9 +387,11 @@ bool mCoreLoadELF(struct mCore* core, struct ELF* elf) {
if (block && bsize >= phdr->p_filesz && esize > phdr->p_offset && esize >= phdr->p_filesz + phdr->p_offset) {
memcpy(block, &bytes[phdr->p_offset], phdr->p_filesz);
} else {
ELFProgramHeadersDeinit(&ph);
return false;
}
}
ELFProgramHeadersDeinit(&ph);
return true;
}