mirror of https://github.com/mgba-emu/mgba.git
GB, GBA Core: Fix memory leak if reloading debug symbols
Also fix loading an ELF if the current seek is not 0
This commit is contained in:
parent
f394c51a75
commit
bdffa83e6b
1
CHANGES
1
CHANGES
|
@ -23,6 +23,7 @@ Other fixes:
|
|||
- Core: Fix inconsistencies with setting game-specific overrides (fixes mgba.io/i/2963)
|
||||
- Debugger: Fix writing to specific segment in command-line debugger
|
||||
- GB: Fix uninitialized save data when loading undersized temporary saves
|
||||
- GB, GBA Core: Fix memory leak if reloading debug symbols
|
||||
- GBA Audio: Fix crash if audio FIFOs and timers get out of sync
|
||||
- GBA Audio: Fix crash in audio subsampling if timing lockstep breaks
|
||||
- GBA Memory: Let raw access read high MMIO addresses
|
||||
|
|
|
@ -1107,7 +1107,9 @@ static void _GBCoreDetachDebugger(struct mCore* core) {
|
|||
}
|
||||
|
||||
static void _GBCoreLoadSymbols(struct mCore* core, struct VFile* vf) {
|
||||
core->symbolTable = mDebuggerSymbolTableCreate();
|
||||
if (!core->symbolTable) {
|
||||
core->symbolTable = mDebuggerSymbolTableCreate();
|
||||
}
|
||||
#ifdef ENABLE_VFS
|
||||
if (!vf && core->dirs.base) {
|
||||
vf = mDirectorySetOpenSuffix(&core->dirs, core->dirs.base, ".sym", O_RDONLY);
|
||||
|
|
|
@ -1243,7 +1243,14 @@ static void _GBACoreDetachDebugger(struct mCore* core) {
|
|||
|
||||
static void _GBACoreLoadSymbols(struct mCore* core, struct VFile* vf) {
|
||||
bool closeAfter = false;
|
||||
core->symbolTable = mDebuggerSymbolTableCreate();
|
||||
if (!core->symbolTable) {
|
||||
core->symbolTable = mDebuggerSymbolTableCreate();
|
||||
}
|
||||
off_t seek;
|
||||
if (vf) {
|
||||
seek = vf->seek(vf, 0, SEEK_CUR);
|
||||
vf->seek(vf, 0, SEEK_SET);
|
||||
}
|
||||
#ifdef ENABLE_VFS
|
||||
#ifdef USE_ELF
|
||||
if (!vf && core->dirs.base) {
|
||||
|
@ -1273,6 +1280,8 @@ static void _GBACoreLoadSymbols(struct mCore* core, struct VFile* vf) {
|
|||
}
|
||||
if (closeAfter) {
|
||||
vf->close(vf);
|
||||
} else {
|
||||
vf->seek(vf, seek, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue