This is the mail archive of the gdb-testers@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]

[binutils-gdb] Fix memory leak in add_symbol_file_command


*** TEST RESULTS FOR COMMIT f978cb06dbfbd93dbd52bd39d992f8644b0c639e ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: f978cb06dbfbd93dbd52bd39d992f8644b0c639e

Fix memory leak in add_symbol_file_command

I happened to notice that add_symbol_file_command leaks "sect_opts".
This patch fixes the leak by changing sect_opts to be a std::vector.

I had to change the logic in the loop a little bit.  Previously, it
was incrementing section_index after completing an entry; but this
changes it to push a new entry when the name is seen.

I believe the argument parsing here is mildly incorrect, in that
nothing checks whether the -s option actually had any arguments.
Maybe gdb can crash if "-s NAME" is given without an argument.  I
didn't try to fix this in this patch, but I do have another patch I
can send later that fixes it up.

Regression tested on the buildbot.

ChangeLog
2017-08-11  Tom Tromey  <tom@tromey.com>

	* symfile.c (add_symbol_file_command): Use std::vector.


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