diff options
author | Alan Modra <amodra@gmail.com> | 2022-06-09 19:53:44 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-06-14 09:56:45 +0930 |
commit | 82cb2524323d4f6eeb2adae3451f31754e271126 (patch) | |
tree | 5cc2389d9e971759b49fcdac75bd91a0a6ef1888 /gas/config | |
parent | a2e7f81e382d641780ce5ae0fe72a309c8a4964d (diff) | |
download | gdb-82cb2524323d4f6eeb2adae3451f31754e271126.zip gdb-82cb2524323d4f6eeb2adae3451f31754e271126.tar.gz gdb-82cb2524323d4f6eeb2adae3451f31754e271126.tar.bz2 |
gas dwarf2dbg.c tidy
Make it a little more obvious that remap_debug_filename returns an
allocated string (that should be freed) by returning a char * rather
than const char *. Free a few missed cases in dwarf2dbg.c, and free
other memory allocated in dwarf2dbg.c. Also remove static
initialisation of variables and initialise in dwarf2_init instead,
in order to ensure gas state is saner for oss-fuzz.
* remap.c (remap_debug_filename): Remove const from return.
* as.h (remap_debug_filename): Update prototype.
* config/obj-elf.c (obj_elf_ident): Simplify free of
remap_debug_filename output.
* stabs.c (stabs_generate_asm_file): Likewise.
* dwarf2dbg.c (dirs, dirs_in_use, dirs_allocated, current): Don't
initialise statically..
(dwarf2_init): ..do so here, along with most other static vars.
(assign_file_to_slot): Don't set files_allocated until we
succeed in allocating memory.
(purge_generated_debug): Add bool param, free more stuff if true.
(dwarf2_directive_filename): Adjust purge_generated_debug call.
(process_entries): Don't free line_entry here..
(dwarf2_cleanup): ..do so here instead, new function.
(dwarf2_finish): Call dwarf2_cleanup. When chaining together
subseg line entries, unhook entries from old subseg list.
(dwarf2_directive_loc): Free remap_debug_filename string.
(out_dir_and_file_list): Likewise.
(out_debug_str): Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/obj-elf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index c02d26b..b768530 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2495,7 +2495,7 @@ obj_elf_ident (int ignore ATTRIBUTE_UNUSED) void obj_elf_init_stab_section (segT seg) { - const char *file; + char *file; char *p; char *stabstr_name; unsigned int stroff; @@ -2514,7 +2514,7 @@ obj_elf_init_stab_section (segT seg) know (stroff == 1 || (stroff == 0 && file[0] == '\0')); md_number_to_chars (p, stroff, 4); seg_info (seg)->stabu.p = p; - xfree ((char *) file); + free (file); } #endif |