all repos — mgba @ 02c3ea80fd9a2020e2b10cbc5cb0e624c77f0940

mGBA Game Boy Advance Emulator

Debugger: Don't automatically free CLI backend
Jeffrey Pfau jeffrey@endrift.com
Wed, 26 Oct 2016 21:43:24 -0700
commit

02c3ea80fd9a2020e2b10cbc5cb0e624c77f0940

parent

e430e55149e3f488359c9cf2c3f7b4e5a0a0a1d5

2 files changed, 5 insertions(+), 10 deletions(-)

jump to
M src/debugger/cli-debugger.csrc/debugger/cli-debugger.c

@@ -678,11 +678,8 @@ }

free(cliDebugger->system); cliDebugger->system = NULL; } - if (cliDebugger->backend) { - if (cliDebugger->backend->deinit) { - cliDebugger->backend->deinit(cliDebugger->backend); - } - free(cliDebugger->backend); + if (cliDebugger->backend && cliDebugger->backend->deinit) { + cliDebugger->backend->deinit(cliDebugger->backend); cliDebugger->backend = NULL; } }

@@ -722,11 +719,8 @@ system->p = debugger;

} void CLIDebuggerAttachBackend(struct CLIDebugger* debugger, struct CLIDebuggerBackend* backend) { - if (debugger->backend) { - if (debugger->backend->deinit) { - debugger->backend->deinit(debugger->backend); - } - free(debugger->backend); + if (debugger->backend && debugger->backend->deinit) { + debugger->backend->deinit(debugger->backend); } debugger->backend = backend;
M src/feature/editline/cli-el-backend.csrc/feature/editline/cli-el-backend.c

@@ -68,6 +68,7 @@ void _CLIDebuggerEditLineDeinit(struct CLIDebuggerBackend* be) {

struct CLIDebuggerEditLineBackend* elbe = (struct CLIDebuggerEditLineBackend*) be; history_end(elbe->histate); el_end(elbe->elstate); + free(elbe); } const char* _CLIDebuggerEditLineReadLine(struct CLIDebuggerBackend* be, size_t* len) {