Core: Fix memory leak loading ELF files

This commit is contained in:
Vicki Pfau 2020-08-17 01:00:36 -07:00
parent 4dcb28ea70
commit 1ad033d925
2 changed files with 3 additions and 0 deletions

View File

@ -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)

View File

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