diff options
author | Alan Modra <amodra@gmail.com> | 2023-04-05 16:44:35 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-04-06 09:51:38 +0930 |
commit | 41e6ffcecbcf62ae1f1aee52fad94b4f02b0706f (patch) | |
tree | 72b1e7f83784259287b55a54643e36f22fe50802 /gdb | |
parent | b5bfe9351ba1de20b7ee0fc60a9c0a49b324d872 (diff) | |
download | gdb-41e6ffcecbcf62ae1f1aee52fad94b4f02b0706f.zip gdb-41e6ffcecbcf62ae1f1aee52fad94b4f02b0706f.tar.gz gdb-41e6ffcecbcf62ae1f1aee52fad94b4f02b0706f.tar.bz2 |
objcopy write_debugging_info memory leaks
The old stabs code didn't bother too much about freeing memory.
This patch corrects that and avoids some dubious copying of strings.
* objcopy.c (write_debugging_info): Free both strings and
syms on failure to create sections.
* wrstabs.c: Delete unnecessary forward declarations and casts
throughout file.
(stab_write_symbol_and_free): New function. Use it
throughout, simplifying return paths.
(stab_push_string): Don't strdup string. Use it thoughout
for malloced strings.
(stab_push_string_dup): New function. Use it throughout for
strings in auto buffers.
(write_stabs_in_sections_debugging_info): Free malloced memory.
(stab_enum_type): Increase buffer sizing for worst case.
(stab_range_type, stab_array_type): Reduce buffer size.
(stab_set_type): Likewise.
(stab_method_type): Free args on error return. Correct
buffer size.
(stab_struct_field): Fix memory leaks.
(stab_class_static_member, stab_class_baseclass): Likewise.
(stab_start_class_type): Likewise. Correct buffer size.
(stab_class_start_method): Correct buffer size.
(stab_class_method_var): Free memory on error return.
(stab_start_function): Fix "rettype" memory leak.
Diffstat (limited to 'gdb')
0 files changed, 0 insertions, 0 deletions