/* Routines to link ECOFF debugging information.
- Copyright (C) 1993-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-2021 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
!= swap->external_hdr_size)
goto error_return;
- if (buff != NULL)
- free (buff);
+ free (buff);
return TRUE;
error_return:
- if (buff != NULL)
- free (buff);
+ free (buff);
return FALSE;
}
return FALSE;
#define WRITE(ptr, count, size, offset) \
- BFD_ASSERT (symhdr->offset == 0 \
- || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
- if (bfd_bwrite (debug->ptr, (bfd_size_type) size * symhdr->count, abfd)\
- != size * symhdr->count) \
+ BFD_ASSERT (symhdr->offset == 0 \
+ || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
+ if (symhdr->count != 0 \
+ && bfd_bwrite (debug->ptr, \
+ (bfd_size_type) size * symhdr->count, \
+ abfd) != size * symhdr->count) \
return FALSE;
WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset);
/* The external strings and symbol are not converted over to using
shuffles. FIXME: They probably should be. */
amt = debug->symbolic_header.issExtMax;
- if (bfd_bwrite (debug->ssext, amt, abfd) != amt)
+ if (amt != 0 && bfd_bwrite (debug->ssext, amt, abfd) != amt)
goto error_return;
if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0)
{
== (bfd_vma) bfd_tell (abfd)));
amt = debug->symbolic_header.iextMax * swap->external_ext_size;
- if (bfd_bwrite (debug->external_ext, amt, abfd) != amt)
+ if (amt != 0 && bfd_bwrite (debug->external_ext, amt, abfd) != amt)
goto error_return;
- if (space != NULL)
- free (space);
+ free (space);
return TRUE;
error_return:
- if (space != NULL)
- free (space);
+ free (space);
return FALSE;
}
\f
if (len != 0)
{
- if (line_info->find_buffer != NULL)
- free (line_info->find_buffer);
+ free (line_info->find_buffer);
buffer = (char *) bfd_malloc ((bfd_size_type) len);
+ line_info->find_buffer = buffer;
if (buffer == NULL)
return FALSE;
- line_info->find_buffer = buffer;
}
if (function_name != NULL)