X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fxsym.c;h=525d6d98abc1bc385acce6593fb57aca8ae7bde9;hb=af0b2a3e85df9f49a3528e5b7578fcf9412f1acc;hp=9c714c64809f2b9c18860da07212d7e6958d9184;hpb=b3adc24a0713411ab38a21dc894dd40dbc5c8f4f;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/xsym.c b/bfd/xsym.c index 9c714c6480..525d6d98ab 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -127,24 +127,12 @@ bfd_sym_valid (bfd *abfd) unsigned char * bfd_sym_read_name_table (bfd *abfd, bfd_sym_header_block *dshb) { - unsigned char *rstr; - long ret; size_t table_size = dshb->dshb_nte.dti_page_count * dshb->dshb_page_size; size_t table_offset = dshb->dshb_nte.dti_first_page * dshb->dshb_page_size; - rstr = bfd_alloc (abfd, table_size); - if (rstr == NULL) - return rstr; - - bfd_seek (abfd, table_offset, SEEK_SET); - ret = bfd_bread (rstr, table_size, abfd); - if (ret < 0 || (unsigned long) ret != table_size) - { - bfd_release (abfd, rstr); - return NULL; - } - - return rstr; + if (bfd_seek (abfd, table_offset, SEEK_SET) != 0) + return FALSE; + return _bfd_alloc_and_read (abfd, table_size, table_size); } void @@ -1808,22 +1796,11 @@ bfd_sym_print_type_information_table_entry (bfd *abfd, fprintf (f, "\n "); - buf = malloc (entry->physical_size); - if (buf == NULL) - { - fprintf (f, "[ERROR]\n"); - return; - } - if (bfd_seek (abfd, entry->offset, SEEK_SET) < 0) - { - fprintf (f, "[ERROR]\n"); - free (buf); - return; - } - if (bfd_bread (buf, entry->physical_size, abfd) != entry->physical_size) + if (bfd_seek (abfd, entry->offset, SEEK_SET) != 0 + || (buf = _bfd_malloc_and_read (abfd, entry->physical_size, + entry->physical_size)) == NULL) { fprintf (f, "[ERROR]\n"); - free (buf); return; } @@ -2253,7 +2230,7 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata) return 0; } -const bfd_target * +bfd_cleanup bfd_sym_object_p (bfd *abfd) { bfd_sym_version version = -1; @@ -2270,7 +2247,7 @@ bfd_sym_object_p (bfd *abfd) if (bfd_sym_scan (abfd, version, mdata) != 0) goto wrong; - return abfd->xvec; + return _bfd_no_cleanup; wrong: bfd_set_error (bfd_error_wrong_format);