Skip to content
Snippets Groups Projects
  1. Jan 04, 2021
  2. Jun 11, 2019
  3. May 10, 2019
  4. Feb 05, 2018
    • 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
  5. Jan 16, 2018
    • Marc-André Lureau's avatar
      readline: add a free function · e5dc1a6c
      Marc-André Lureau authored
      
      Fixes leaks such as:
      
      Direct leak of 2 byte(s) in 1 object(s) allocated from:
          #0 0x7eff58beb850 in malloc (/lib64/libasan.so.4+0xde850)
          #1 0x7eff57942f0c in g_malloc ../glib/gmem.c:94
          #2 0x7eff579431cf in g_malloc_n ../glib/gmem.c:331
          #3 0x7eff5795f6eb in g_strdup ../glib/gstrfuncs.c:363
          #4 0x55db720f1d46 in readline_hist_add /home/elmarco/src/qq/util/readline.c:258
          #5 0x55db720f2d34 in readline_handle_byte /home/elmarco/src/qq/util/readline.c:387
          #6 0x55db71539d00 in monitor_read /home/elmarco/src/qq/monitor.c:3896
          #7 0x55db71f9be35 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:167
          #8 0x55db71f9bed3 in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:179
          #9 0x55db71fa013c in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.c:66
          #10 0x55db71fe18a8 in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84
          #11 0x7eff5793a90b in g_main_dispatch ../glib/gmain.c:3182
          #12 0x7eff5793b7ac in g_main_context_dispatch ../glib/gmain.c:3847
          #13 0x55db720af3bd in glib_pollfds_poll /home/elmarco/src/qq/util/main-loop.c:214
          #14 0x55db720af505 in os_host_main_loop_wait /home/elmarco/src/qq/util/main-loop.c:261
          #15 0x55db720af6d6 in main_loop_wait /home/elmarco/src/qq/util/main-loop.c:515
          #16 0x55db7184e0de in main_loop /home/elmarco/src/qq/vl.c:1995
          #17 0x55db7185e956 in main /home/elmarco/src/qq/vl.c:4914
          #18 0x7eff4ea17039 in __libc_start_main (/lib64/libc.so.6+0x21039)
      
      (while at it, use g_new0(ReadLineState), it's a bit easier to read)
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <20180104160523.22995-11-marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e5dc1a6c
  6. Mar 22, 2016
  7. Feb 04, 2016
  8. Jun 11, 2014
  9. May 07, 2014
  10. Jan 22, 2014
    • Stefan Hajnoczi's avatar
      readline: move readline to a generic location · 0150cd81
      Stefan Hajnoczi authored
      
      Now that the monitor and readline are decoupled, readline.h no longer
      belongs in include/monitor/.  Put the header into include/qemu/.
      
      Move the source file into util/ so it can be linked as part of
      libqemuutil.a.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      0150cd81
    • Stefan Hajnoczi's avatar
      readline: decouple readline from the monitor · c60bf339
      Stefan Hajnoczi authored
      
      Make the readline.c functionality reusable.  Instead of calling
      monitor_printf() and monitor_flush() directly, invoke function pointers
      provided by the user.
      
      This way readline.c does not know about Monitor and other users will be
      able to make use of readline.c.
      
      Note that there is already an "opaque" argument to the ReadLineFunc
      callback.  Consistently call it "readline_opaque" from now on to
      distinguish from the ReadLinePrintfFunc/ReadLineFlushFunc "opaque"
      argument.
      
      I also dropped the printf macro trickery since it's now highly unlikely
      that anyone modifying readline.c would call printf(3) directly.  We no
      longer need this protection.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      c60bf339
  11. Aug 30, 2013
  12. May 14, 2013
  13. Jan 30, 2013
  14. Jan 08, 2013
  15. Dec 19, 2012
  16. Jun 15, 2012
  17. Jun 11, 2012
  18. Nov 07, 2011
  19. Aug 21, 2011
  20. Feb 08, 2010
  21. Feb 06, 2010
  22. Jun 16, 2009
  23. Mar 13, 2009
  24. Mar 05, 2009
  25. Feb 05, 2009
  26. Dec 13, 2008
  27. Nov 16, 2008
  28. Dec 17, 2007
  29. Nov 17, 2007
  30. Sep 25, 2007
Loading