Debugger: Don't automatically free CLI backend
Jeffrey Pfau jeffrey@endrift.com
Wed, 26 Oct 2016 21:43:24 -0700
2 files changed,
5 insertions(+),
10 deletions(-)
M
src/debugger/cli-debugger.c
→
src/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.c
→
src/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) {