From: Paolo Bonzini <pbonzini@redhat.com>
To: Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] readline: don't free completions in readline_free()
Date: Thu, 18 Jan 2018 11:45:43 +0100 [thread overview]
Message-ID: <36cc0b97-2214-fc42-085c-78d3e4fe6da4@redhat.com> (raw)
In-Reply-To: <151627206353.4505.4602428849861610759.stgit@bahia.lan>
On 18/01/2018 11:41, Greg Kurz wrote:
> 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 ***
>
> #0 0x00007ffff267eff0 in raise () from /lib64/libc.so.6
> #1 0x00007ffff268136c in abort () from /lib64/libc.so.6
> #2 0x00007ffff26c6b48 in __libc_message () from /lib64/libc.so.6
> #3 0x00007ffff26d69fc in free () from /lib64/libc.so.6
> #4 0x00007ffff28cb794 in g_free () from /lib64/libglib-2.0.so.0
> #5 0x00000000106230e4 in readline_free (rs=0x11223e60) at
> /home/greg/Work/qemu/qemu-spapr/util/readline.c:514
> #6 0x0000000010074cc4 in monitor_data_destroy (mon=0x1121c9f0) at
> /home/greg/Work/qemu/qemu-spapr/monitor.c:586
> #7 0x000000001007bcc8 in monitor_cleanup () at
> /home/greg/Work/qemu/qemu-spapr/monitor.c:4125
> #8 0x0000000010291274 in main (argc=<optimized out>,
> 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>
> ---
> util/readline.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/util/readline.c b/util/readline.c
> index 24ec839854cf..ec91ee0fea6f 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);
> }
>
>
Queued, thanks.
Paolo
next prev parent reply other threads:[~2018-01-18 10:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 10:41 [Qemu-devel] [PATCH] readline: don't free completions in readline_free() Greg Kurz
2018-01-18 10:45 ` Paolo Bonzini [this message]
2018-01-18 11:16 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36cc0b97-2214-fc42-085c-78d3e4fe6da4@redhat.com \
--to=pbonzini@redhat.com \
--cc=dgilbert@redhat.com \
--cc=f4bug@amsat.org \
--cc=groug@kaod.org \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).