aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2018-01-18 11:41:03 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-02-05 13:54:39 +0100
commit4183e2ea6d092ea9d7f18af085cb1076fae08512 (patch)
tree82bb2e98bdf99acff21da2dde27b7c54b080f272
parent4e4b57342e14f260ca6e2d4cfcbafb876d227909 (diff)
readline: don't free completions in readline_free()
Since commit e5dc1a6c6c43, QEMU aborts on exit if completion was used in the monitor: *** Error in `obj/ppc64-softmmu/qemu-system-ppc64': double free or corruption (fasttop): 0x00000100331069d0 *** /home/greg/Work/qemu/qemu-spapr/util/readline.c:514 /home/greg/Work/qemu/qemu-spapr/monitor.c:586 /home/greg/Work/qemu/qemu-spapr/monitor.c:4125 argv=<optimized out>, envp=<optimized out>) at /home/greg/Work/qemu/qemu-spapr/vl.c:4795 Completion strings are not persistent accross completions (why would they?). They are allocated under readline_completion(), which already takes care of freeing them before returning. Maybe all completion related bits should be moved out of ReadLineState to a dedicated structure ? In the meantime, let's drop the offending lines from readline_free() to fix the crash. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <151627206353.4505.4602428849861610759.stgit@bahia.lan> Fixes: e5dc1a6c6c43 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--util/readline.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/util/readline.c b/util/readline.c
index 24ec839854..ec91ee0fea 100644
--- a/util/readline.c
+++ b/util/readline.c
@@ -510,9 +510,6 @@ void readline_free(ReadLineState *rs)
for (i = 0; i < READLINE_MAX_CMDS; i++) {
g_free(rs->history[i]);
}
- for (i = 0; i < READLINE_MAX_COMPLETIONS; i++) {
- g_free(rs->completions[i]);
- }
g_free(rs);
}