Skip to content
  • Greg Kurz's avatar
    readline: don't free completions in readline_free() · 4183e2ea
    Greg Kurz authored
    Since commit e5dc1a6c
    
    , 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: default avatarGreg Kurz <groug@kaod.org>
    Message-Id: <151627206353.4505.4602428849861610759.stgit@bahia.lan>
    Fixes: e5dc1a6c
    
    
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    4183e2ea