mirror of https://github.com/mgba-emu/mgba.git
Core: Fix memory leak loading ELF files
This commit is contained in:
parent
f4522c3942
commit
343812e9e6
1
CHANGES
1
CHANGES
|
@ -39,6 +39,7 @@ Other fixes:
|
||||||
- All: Improve export headers (fixes mgba.io/i/1738)
|
- All: Improve export headers (fixes mgba.io/i/1738)
|
||||||
- Core: Ensure ELF regions can be written before trying
|
- Core: Ensure ELF regions can be written before trying
|
||||||
- Core: Fix reported ROM size when a fixed buffer size is used
|
- 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
|
- Debugger: Don't skip undefined instructions when debugger attached
|
||||||
- FFmpeg: Fix some small memory leaks
|
- FFmpeg: Fix some small memory leaks
|
||||||
- FFmpeg: Fix encoding of time base
|
- FFmpeg: Fix encoding of time base
|
||||||
|
|
|
@ -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) {
|
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);
|
memcpy(block, &bytes[phdr->p_offset], phdr->p_filesz);
|
||||||
} else {
|
} else {
|
||||||
|
ELFProgramHeadersDeinit(&ph);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ELFProgramHeadersDeinit(&ph);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue