+2020-01-13 Alan Modra <amodra@gmail.com>
+
+ PR 23560
+ PR 23561
+ * dwarf.c (display_debug_frames): Move fde_fc earlier. Free
+ fde_fc col_type and col_offset.
+ * readelf.c (apply_relocations): Move symsec check earlier.
+ (free_debug_section): Free reloc_info.
+ (process_notes_at): Free pnotes on error path.
+ (process_object): Free dump_sects here..
+ (process_archive): ..not here.
+
2020-01-13 Alan Modra <amodra@gmail.com>
PR 25362
unsigned int offset_size;
unsigned int initial_length_size;
bfd_boolean all_nops;
+ static Frame_Chunk fde_fc;
saved_start = start;
else
{
unsigned char *look_for;
- static Frame_Chunk fde_fc;
unsigned long segment_selector;
if (is_eh)
if (do_debug_frames_interp && ! all_nops)
frame_display_row (fc, &need_col_headers, &max_regs);
+ if (fde_fc.col_type != NULL)
+ {
+ free (fde_fc.col_type);
+ fde_fc.col_type = NULL;
+ }
+ if (fde_fc.col_offset != NULL)
+ {
+ free (fde_fc.col_offset);
+ fde_fc.col_offset = NULL;
+ }
+
start = block_end;
eh_addr_size = saved_eh_addr_size;
}
|| relsec->sh_link >= filedata->file_header.e_shnum)
continue;
+ symsec = filedata->section_headers + relsec->sh_link;
+ if (symsec->sh_type != SHT_SYMTAB
+ && symsec->sh_type != SHT_DYNSYM)
+ return FALSE;
+
is_rela = relsec->sh_type == SHT_RELA;
if (is_rela)
if (filedata->file_header.e_machine == EM_SH)
is_rela = FALSE;
- symsec = filedata->section_headers + relsec->sh_link;
- if (symsec->sh_type != SHT_SYMTAB
- && symsec->sh_type != SHT_DYNSYM)
- return FALSE;
symtab = GET_ELF_SYMBOLS (filedata, symsec, & num_syms);
for (rp = relocs; rp < relocs + num_relocs; ++rp)
section->start = NULL;
section->address = 0;
section->size = 0;
+
+ if (section->reloc_info != NULL)
+ {
+ free (section->reloc_info);
+ section->reloc_info = NULL;
+ section->num_relocs = 0;
+ }
}
static bfd_boolean
{
warn (_("Corrupt note: alignment %ld, expecting 4 or 8\n"),
(long) align);
+ free (pnotes);
return FALSE;
}
filedata->string_table = NULL;
filedata->string_table_length = 0;
+ if (filedata->dump_sects != NULL)
+ {
+ free (filedata->dump_sects);
+ filedata->dump_sects = NULL;
+ filedata->num_dump_sects = 0;
+ }
+
if (dynamic_strings)
{
free (dynamic_strings);
ret = FALSE;
}
- if (filedata->dump_sects != NULL)
- {
- free (filedata->dump_sects);
- filedata->dump_sects = NULL;
- filedata->num_dump_sects = 0;
- }
-
free (qualified_name);
}