som_swap_subspace_dictionary_in (&ext_subspace, &subspace);
/* Setup the subspace name string. */
+ if (subspace.name >= file_hdr->space_strings_size)
+ goto error_return;
+
subspace_name = subspace.name + space_strings;
amt = strlen (subspace_name) + 1;
for (i = 0; i < total_subspaces; i++)
subspace_sections[i]->target_index = i;
- if (space_strings != NULL)
- free (space_strings);
-
- if (subspace_sections != NULL)
- free (subspace_sections);
-
+ free (space_strings);
+ free (subspace_sections);
return TRUE;
error_return:
- if (space_strings != NULL)
- free (space_strings);
-
- if (subspace_sections != NULL)
- free (subspace_sections);
+ free (space_strings);
+ free (subspace_sections);
return FALSE;
}
if (bfd_bwrite ((void *) som_symtab, symtab_size, abfd) != symtab_size)
goto error_return;
- if (som_symtab != NULL)
- free (som_symtab);
+ free (som_symtab);
return TRUE;
+
error_return:
- if (som_symtab != NULL)
- free (som_symtab);
+ free (som_symtab);
return FALSE;
}
/* Save our results and return success. */
obj_som_symtab (abfd) = symbase;
successful_return:
- if (buf != NULL)
- free (buf);
+ free (buf);
return (TRUE);
error_return:
- if (symbase != NULL)
- free (symbase);
- if (buf != NULL)
- free (buf);
+ free (symbase);
+ free (buf);
return FALSE;
}
if (!bfd_malloc_and_get_section (section->owner, section,
&contents))
{
- if (contents != NULL)
- free (contents);
+ free (contents);
return (unsigned) -1;
}
section->contents = contents;
(*count)++;
}
}
- if (hash_table != NULL)
- free (hash_table);
+ free (hash_table);
return TRUE;
error_return:
- if (hash_table != NULL)
- free (hash_table);
+ free (hash_table);
return FALSE;
}
}
/* If we haven't died by now, then we successfully read the entire
archive symbol table. */
- if (hash_table != NULL)
- free (hash_table);
- if (som_dict != NULL)
- free (som_dict);
+ free (hash_table);
+ free (som_dict);
return TRUE;
error_return:
- if (hash_table != NULL)
- free (hash_table);
- if (som_dict != NULL)
- free (som_dict);
+ free (hash_table);
+ free (som_dict);
return FALSE;
}
if (bfd_bwrite ((void *) strings, amt, abfd) != amt)
goto error_return;
- if (hash_table != NULL)
- free (hash_table);
- if (som_dict != NULL)
- free (som_dict);
- if (last_hash_entry != NULL)
- free (last_hash_entry);
- if (lst_syms != NULL)
- free (lst_syms);
- if (strings != NULL)
- free (strings);
+ free (hash_table);
+ free (som_dict);
+ free (last_hash_entry);
+ free (lst_syms);
+ free (strings);
return TRUE;
error_return:
- if (hash_table != NULL)
- free (hash_table);
- if (som_dict != NULL)
- free (som_dict);
- if (last_hash_entry != NULL)
- free (last_hash_entry);
- if (lst_syms != NULL)
- free (lst_syms);
- if (strings != NULL)
- free (strings);
+ free (hash_table);
+ free (som_dict);
+ free (last_hash_entry);
+ free (lst_syms);
+ free (strings);
return FALSE;
}
unsigned int module_count;
/* We'll use this for the archive's date and mode later. */
- if (stat (abfd->filename, &statbuf) != 0)
+ if (stat (bfd_get_filename (abfd), &statbuf) != 0)
{
bfd_set_error (bfd_error_system_call);
return FALSE;
{
asection *o;
-#define FREE(x) if (x != NULL) { free (x); x = NULL; }
+#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));