This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Fix leak in most gdb.mi tests.


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]