This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix leak in most gdb.mi tests.
- From: Tom Tromey <tom at tromey dot com>
- To: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 29 Dec 2018 12:15:32 -0700
- Subject: Re: [RFA] Fix leak in most gdb.mi tests.
- References: <20181229170116.8588-1-philippe.waroquiers@skynet.be>
>>>>> "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