gdb_exception make_shared std::string leaking

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
==26624== VALGRIND_GDB_ERROR_END
==26624== VALGRIND_GDB_ERROR_BEGIN
==26624== 217,785 (111,936 direct, 105,849 indirect) bytes in 2,332 blocks are definitely lost in loss record 3,263 of 3,278
==26624== at 0x4C2C4CC: operator new(unsigned long) (vg_replace_malloc.c:344)
==26624== by 0x41BCA8: allocate (new_allocator.h:104)
==26624== by 0x41BCA8: allocate (alloc_traits.h:436)
==26624== by 0x41BCA8: __allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> >, (__gnu_cxx::_Lock_policy)2u> > > (allocated_ptr.h:103)
==26624== by 0x41BCA8: __shared_count<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (shared_ptr_base.h:613)
==26624== by 0x41BCA8: __shared_ptr<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (shared_ptr_base.h:1100)
==26624== by 0x41BCA8: shared_ptr<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (shared_ptr.h:319)
==26624== by 0x41BCA8: allocate_shared<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (shared_ptr.h:620)
==26624== by 0x41BCA8: make_shared<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (shared_ptr.h:636)
==26624== by 0x41BCA8: gdb_exception::gdb_exception(return_reason, errors, char const*, __va_list_tag*) (common-exceptions.h:132)
==26624== by 0x41B593: gdb_exception_error (common-exceptions.h:229)
==26624== by 0x41B593: throw_it (common-exceptions.c:201)
==26624== by 0x41B593: throw_verror(errors, char const*, __va_list_tag*) (common-exceptions.c:209)
==26624== by 0x695843: verror(char const*, __va_list_tag*) (utils.c:168)
==26624== by 0x41DA1B: error(char const*, ...) (errors.c:43)
==26624== by 0x3F1F58: c_yyerror(char const*) (c-exp.y:3415)
==26624== by 0x3F8F13: c_yyparse() (c-exp.c.tmp:4212)
==26624== by 0x3F937B: c_parse(parser_state*) (c-exp.y:3348)
==26624== by 0x58EB48: parse_exp_in_context(char const**, unsigned long, block const*, int, int, int*, innermost_block_tracker*, expr_completion_state*) [clone .constprop.37] (parse.c:1123)
==26624== by 0x58EE64: parse_exp_1 (parse.c:1032)
==26624== by 0x58EE64: parse_expression(char const*, innermost_block_tracker*) (parse.c:1168)
==26624== by 0x681D5F: whatis_exp(char const*, int) (typeprint.c:515)
==26624== by 0x40AB38: cmd_func(cmd_list_element*, char const*, int) (cli-decode.c:1892)
==26624== by 0x670489: execute_command(char const*, int) (top.c:630)
==26624== by 0x4B751B: command_handler(char const*) (event-top.c:582)
==26624== by 0x4B784C: command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) (event-top.c:769)
==26624== by 0x4B7C80: gdb_rl_callback_handler(char*) (event-top.c:213)
==26624== by 0x4E68AC2: rl_callback_read_char (callback.c:283)
==26624== by 0x4B6B25: gdb_rl_callback_read_char_wrapper_noexcept() (event-top.c:175)
==26624== by 0x4B7E7C: gdb_rl_callback_read_char_wrapper(void*) (event-top.c:192)
==26624== by 0x4B698F: stdin_event_handler(int, void*) (event-top.c:510)
==26624== by 0x4B5A1C: gdb_wait_for_event(int) (event-loop.c:857)
==26624== by 0x4B5B26: gdb_do_one_event() [clone .part.7] (event-loop.c:321)
==26624== by 0x4B64AD: gdb_do_one_event (event-loop.c:303)
==26624== by 0x4B64AD: start_event_loop() (event-loop.c:370)
==26624== by 0x54EEC7: captured_command_loop() (main.c:331)
==26624== by 0x54FECC: captured_main (main.c:1173)
==26624== by 0x54FECC: gdb_main(captured_main_args*) (main.c:1188)
==26624== by 0x297C37: main (gdb.c:32)