diff options
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/libbfd.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cd904da..548ed9f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2021-04-30 Nick Clifton <nickc@redhat.com> + PR 27797 + * libbfd.c (bfd_realloc_or_free): Do not free a pointer than has + been realloc'ed to size 0. + +2021-04-30 Nick Clifton <nickc@redhat.com> + PR 27795 * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Check for invalid name lengths. diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 9db14c3..52c9245 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -312,7 +312,7 @@ bfd_realloc_or_free (void *ptr, bfd_size_type size) { void *ret = bfd_realloc (ptr, size); - if (ret == NULL) + if (ret == NULL && size > 0) free (ptr); return ret; |