Core: Fix memory leak loading ELF files
Vicki Pfau vi@endrift.com
Mon, 17 Aug 2020 01:00:36 -0700
2 files changed,
3 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -39,6 +39,7 @@ - 3DS: Fix crash with libctru 2.0 when exiting
- 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
M
src/core/core.c
→
src/core/core.c
@@ -387,9 +387,11 @@ char* bytes = ELFBytes(elf, &esize);
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; }