bool
NAME (aout, bfd_free_cached_info) (bfd *abfd)
{
- if ((bfd_get_format (abfd) == bfd_object
- || bfd_get_format (abfd) == bfd_core)
+#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
+ if (bfd_get_format (abfd) == bfd_object
&& abfd->tdata.aout_data != NULL)
{
-#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
BFCI_FREE (adata (abfd).line_buf);
BFCI_FREE (obj_aout_symbols (abfd));
BFCI_FREE (obj_aout_external_syms (abfd));
BFCI_FREE (obj_aout_external_strings (abfd));
- for (asection *o = abfd->sections; o != NULL; o = o->next)
- BFCI_FREE (o->relocation);
-#undef BFCI_FREE
}
+ for (asection *o = abfd->sections; o != NULL; o = o->next)
+ BFCI_FREE (o->relocation);
+#undef BFCI_FREE
+
return _bfd_generic_bfd_free_cached_info (abfd);
}
\f
{
struct ecoff_tdata *tdata;
- if ((bfd_get_format (abfd) == bfd_object
- || bfd_get_format (abfd) == bfd_core)
+ if (bfd_get_format (abfd) == bfd_object
&& (tdata = ecoff_data (abfd)) != NULL)
{
while (tdata->mips_refhi_list != NULL)
bool
NAME (aout, bfd_free_cached_info) (bfd *abfd)
{
- if ((bfd_get_format (abfd) == bfd_object
- || bfd_get_format (abfd) == bfd_core)
+#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
+ if (bfd_get_format (abfd) == bfd_object
&& abfd->tdata.aout_data != NULL)
{
-#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
BFCI_FREE (adata (abfd).line_buf);
BFCI_FREE (obj_aout_symbols (abfd));
BFCI_FREE (obj_aout_external_syms (abfd));
BFCI_FREE (obj_aout_external_strings (abfd));
- for (asection *o = abfd->sections; o != NULL; o = o->next)
- BFCI_FREE (o->relocation);
-#undef BFCI_FREE
}
+ for (asection *o = abfd->sections; o != NULL; o = o->next)
+ BFCI_FREE (o->relocation);
+#undef BFCI_FREE
+
return _bfd_generic_bfd_free_cached_info (abfd);
}
\f
static bool
som_bfd_free_cached_info (bfd *abfd)
{
+#define FREE(x) do { free (x); x = NULL; } while (0)
if (bfd_get_format (abfd) == bfd_object
- || bfd_get_format (abfd) == bfd_core)
+ && abfd->tdata.som_data != NULL)
{
- asection *o;
-
-#define FREE(x) do { free (x); x = NULL; } while (0)
/* Free the native string and symbol tables. */
FREE (obj_som_symtab (abfd));
FREE (obj_som_stringtab (abfd));
- for (o = abfd->sections; o != NULL; o = o->next)
- {
- /* Free the native relocations. */
- o->reloc_count = (unsigned) -1;
- FREE (som_section_data (o)->reloc_stream);
- /* Do not free the generic relocations as they are objalloc'ed. */
- }
-#undef FREE
}
+ for (asection *o = abfd->sections; o != NULL; o = o->next)
+ {
+ /* Free the native relocations. */
+ o->reloc_count = (unsigned) -1;
+ FREE (som_section_data (o)->reloc_stream);
+ /* Do not free the generic relocations as they are objalloc'ed. */
+ }
+#undef FREE
+
/* Do not call _bfd_generic_bfd_free_cached_info here.
som_write_armap needs to access the bfd objalloc memory. */
return true;