X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fihex.c;h=4055d47e3d9efdcd1b0c594f91b7e0ced090277b;hb=14962256b310efddf677ff4f5c9fa41047f48c39;hp=68671cc6239357ec76088eccf87cb11f6e5227ff;hpb=cb001c0d283dd884efe06770d033a50fb1bc6c7d;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/ihex.c b/bfd/ihex.c index 68671cc623..4055d47e3d 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -381,8 +381,7 @@ ihex_scan (bfd *abfd) /* An end record. */ if (abfd->start_address == 0) abfd->start_address = addr; - if (buf != NULL) - free (buf); + free (buf); return TRUE; case 2: @@ -474,14 +473,11 @@ ihex_scan (bfd *abfd) if (error) goto error_return; - if (buf != NULL) - free (buf); - + free (buf); return TRUE; error_return: - if (buf != NULL) - free (buf); + free (buf); return FALSE; } @@ -603,8 +599,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) if ((bfd_size_type) (p - contents) >= section->size) { /* We've read everything in the section. */ - if (buf != NULL) - free (buf); + free (buf); return TRUE; } @@ -621,14 +616,11 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) goto error_return; } - if (buf != NULL) - free (buf); - + free (buf); return TRUE; error_return: - if (buf != NULL) - free (buf); + free (buf); return FALSE; } @@ -811,16 +803,15 @@ ihex_write_object_contents (bfd *abfd) if (count > CHUNK) now = CHUNK; - if (where > segbase + extbase + 0xffff) + if (where < extbase + || where - extbase < segbase + || where - extbase - segbase > 0xffff) { bfd_byte addr[2]; /* We need a new base address. */ - if (where <= 0xfffff) + if (extbase == 0 && where <= 0xfffff) { - /* The addresses should be sorted. */ - BFD_ASSERT (extbase == 0); - segbase = where & 0xf0000; addr[0] = (bfd_byte)(segbase >> 12) & 0xff; addr[1] = (bfd_byte)(segbase >> 4) & 0xff;