diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-09-29 18:26:23 +0200 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-10-01 08:56:54 +0200 |
commit | cd7c32c36ae53c00e9b0731c58de37dc28b88fb6 (patch) | |
tree | d5e98784a3f96cffc47448f1f0d716bcf8757002 /gdb/tui | |
parent | 8fe0f950f4c0438e684a532add46dc99ee32165c (diff) | |
download | gdb-cd7c32c36ae53c00e9b0731c58de37dc28b88fb6.zip gdb-cd7c32c36ae53c00e9b0731c58de37dc28b88fb6.tar.gz gdb-cd7c32c36ae53c00e9b0731c58de37dc28b88fb6.tar.bz2 |
Fix leak due to assigning a xstrdup-ed string to the std::string gdb_datadir
Valgrind reports the following leak:
==32623== 56 bytes in 1 blocks are definitely lost in loss record 1,099 of 6,654
==32623== at 0x4835753: malloc (vg_replace_malloc.c:307)
==32623== by 0x25CF67: xmalloc (alloc.c:60)
==32623== by 0x65FBD9: xstrdup (xstrdup.c:34)
==32623== by 0x413D9E: captured_main_1(captured_main_args*) (main.c:553)
==32623== by 0x414FFA: captured_main (main.c:1172)
==32623== by 0x414FFA: gdb_main(captured_main_args*) (main.c:1197)
==32623== by 0x22531A: main (gdb.c:32)
Commit f2aec7f6d14 changed gdb_datadir to std::string.
So, xstrdup-ing the result of relocate_gdb_directory (returning a std::string)
is not needed and creates a leak.
Fix the leak by removing the xstrdup and the not needed c_str ().
Also removes a useless conversion of gdb_datadir to std::string.
gdb/ChangeLog
2019-10-01 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* main.c (relocate_gdbinit_path_maybe_in_datadir): Remove std::string
conversion of gdb_datadir.
(captured_main_1): Remove xstrdup when assigning to gdb_datadir,
remove not needed c_str ().
Diffstat (limited to 'gdb/tui')
0 files changed, 0 insertions, 0 deletions