mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
Fix a double free when re-allocating a buffer to size 0.
PR 27797 * libbfd.c (bfd_realloc_or_free): Do not free a pointer than has been realloc'ed to size 0.
This commit is contained in:
parent
bfbfa6e7f4
commit
6cb40a679b
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user