Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix leak in most gdb.mi tests.
Date: Sat, 29 Dec 2018 19:15:00 -0000	[thread overview]
Message-ID: <87a7kom9ez.fsf@tromey.com> (raw)
In-Reply-To: <20181229170116.8588-1-philippe.waroquiers@skynet.be> (Philippe	Waroquiers's message of "Sat, 29 Dec 2018 18:01:16 +0100")

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Fix the leak by freeing in mi_execute_command_input_handler
Philippe> the command allocated in gdb_readline_no_editing_callback.

Philippe> Tested on amd64, native and under valgrind.

Philippe> gdb/ChangeLog
Philippe> 2018-12-29  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

Philippe> 	* mi/mi-interp.c (mi_execute_command_input_handler): xfree cmd,
Philippe> 	allocated in gdb_readline_no_editing_callback.

Thanks.

Would you mind adding to the comment comment above struct ui::input_handler
(in top.h) to explain that input_handler takes ownership of the string?

This all seems somewhat ugly to me.  Perhaps ideally the caller should
manage the memory and input_handler should take a const char *?  But not
your problem, fixing the leak is enough.

This is ok with the comment tweak.

Tom


  reply	other threads:[~2018-12-29 19:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-29 17:01 Philippe Waroquiers
2018-12-29 19:15 ` Tom Tromey [this message]
2018-12-29 19:33   ` Tom Tromey
2018-12-29 19:44     ` Tom Tromey
2018-12-30  9:28       ` Philippe Waroquiers
2018-12-30 15:55         ` Tom Tromey
2018-12-30 21:24           ` Philippe Waroquiers
2018-12-30 23:43             ` Tom Tromey

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=87a7kom9ez.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /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