all repos — mgba @ 1ad033d9254795cac4c6db28e4bcab815e3dfb78

mGBA Game Boy Advance Emulator

Core: Fix memory leak loading ELF files
Vicki Pfau vi@endrift.com
Mon, 17 Aug 2020 01:00:36 -0700
commit

1ad033d9254795cac4c6db28e4bcab815e3dfb78

parent

4dcb28ea703bc111d979ffdb85c7fdb8c5ea3656

2 files changed, 3 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -9,6 +9,7 @@ Other fixes:

- 3DS: Redo video sync to be more precise - 3DS: Fix crash with libctru 2.0 when exiting - Core: Fix reported ROM size when a fixed buffer size is used + - Core: Fix memory leak loading ELF files - GBA: Disable more checks when loading GS save with checks disabled (fixes mgba.io/i/1851) - GBA Core: Fix memory leak when loading symbols - Qt: Add dummy English translation file (fixes mgba.io/i/1469)
M src/core/core.csrc/core/core.c

@@ -376,9 +376,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; }