This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix leak in event-top.c history expansion
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Mon, 21 Jan 2019 15:44:51 -0500
- Subject: [binutils-gdb] Fix leak in event-top.c history expansion
*** TEST RESULTS FOR COMMIT b6fb1ee51c9a773d2d6044993af6c0fd7499638f ***
Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Branch: master
Commit: b6fb1ee51c9a773d2d6044993af6c0fd7499638f
Fix leak in event-top.c history expansion
E.g. in gdb.base/default.exp, valgrind detects leaks such as
==17663== 1,438 bytes in 101 blocks are definitely lost in loss record 2,804 of 2,884
==17663== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==17663== by 0x418A17: xmalloc (common-utils.c:44)
==17663== by 0x4E6F19C: history_expand (histexpand.c:1061)
==17663== by 0x4B4490: handle_line_of_input(buffer*, char const*, int, char const*) (event-top.c:685)
==17663== by 0x4B4562: command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) (event-top.c:753)
...
Fix the leak by using an unique_xmalloc_ptr for history_value.
gdb/ChangeLog
2019-01-22 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* event-top.c (handle_line_of_input): use unique_xmalloc_ptr for
history_value.