* vms-lib.c (_bfd_vms_lib_get_module): Use bfd_zmalloc for

areltdata.
	* opncls.c (_bfd_delete_bfd): Free arelt_data.
	* mach-o.c (bfd_mach_o_fat_member_init): Use bfd_zmalloc for
	areltdata.
	* ecoff.c (_bfd_ecoff_slurp_armap): Use free for mapdata.
	* coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Use bfd_zmalloc for
	areltdata.
	(xcoff_write_archive_contents_old): Likewise.
	(xcoff_write_archive_contents_big): Likewise.
	* archive64.c (bfd_elf64_archive_slurp_armap): Use free for
	areltdata.
	* archive.c (_bfd_generic_read_ar_hdr_mag): Use bfd_zmalloc and
	free for areltdata.
	(_bfd_get_elt_at_filepos): Likewise.  Clear n_nfd->arelt_data on
	failure.
	(do_slurp_bsd_armap): Use bfd_zmalloc and free for areltdata.
	(do_slurp_coff_armap): Likewise.
	(_bfd_slurp_extended_name_table): Likewise.
	(bfd_slurp_bsd_armap_f2): Likewise.  Don't leak 'mapdata'.
This commit is contained in:
Tom Tromey
2012-08-20 14:32:31 +00:00
parent 542385d9f7
commit 06e7acd76f
8 changed files with 52 additions and 22 deletions

View File

@@ -1496,7 +1496,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
struct areltdata *ret;
bfd_size_type amt = sizeof (struct areltdata);
ret = (struct areltdata *) bfd_alloc (abfd, amt);
ret = (struct areltdata *) bfd_zmalloc (amt);
if (ret == NULL)
return NULL;
@@ -2113,7 +2113,7 @@ xcoff_write_archive_contents_old (bfd *abfd)
total_namlen += strlen (normalize_filename (sub)) + 1;
if (sub->arelt_data == NULL)
{
sub->arelt_data = bfd_zalloc (sub, sizeof (struct areltdata));
sub->arelt_data = bfd_zmalloc (sizeof (struct areltdata));
if (sub->arelt_data == NULL)
return FALSE;
}
@@ -2329,7 +2329,7 @@ xcoff_write_archive_contents_big (bfd *abfd)
if (current_bfd->arelt_data == NULL)
{
size = sizeof (struct areltdata);
current_bfd->arelt_data = bfd_zalloc (current_bfd, size);
current_bfd->arelt_data = bfd_zmalloc (size);
if (current_bfd->arelt_data == NULL)
return FALSE;
}