X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fbfdio.c;h=5f144bc7f3fee833ff97924ec8f2e3eec37364b9;hb=e822f2cda9bc484adb5f8860050640a5c6f1ced9;hp=bba8d896d3a7849a8fd7449dec923b72a11458b0;hpb=ca859a893931d6fad8b35cf2c20afd43422a59fe;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/bfdio.c b/bfd/bfdio.c index bba8d896d3..5f144bc7f3 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -130,7 +130,7 @@ _bfd_real_fopen (const char *filename, const char *modes) strcat (fullpath, filename); /* Convert any UNIX style path separators into the DOS form. */ - for (i = 0, fullpath[i]; i++) + for (i = 0; fullpath[i]; i++) { if (IS_UNIX_DIR_SEPARATOR (fullpath[i])) fullpath[i] = '\\'; @@ -495,8 +495,9 @@ bfd_get_file_size (bfd *abfd) struct areltdata *adata = (struct areltdata *) abfd->arelt_data; archive_size = adata->parsed_size; /* If the archive is compressed we can't compare against file size. */ - if (memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag, - "Z\012", 2) == 0) + if (adata->arch_header != NULL + && memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag, + "Z\012", 2) == 0) return archive_size; abfd = abfd->my_archive; } @@ -662,8 +663,7 @@ memory_bclose (struct bfd *abfd) { struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream; - if (bim->buffer != NULL) - free (bim->buffer); + free (bim->buffer); free (bim); abfd->iostream = NULL;