diff options
author | Alan Modra <amodra@gmail.com> | 2018-10-16 15:23:20 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-10-16 16:41:57 +1030 |
commit | 8df73d5cc3a87101f3bd254f33820fcce61bc971 (patch) | |
tree | c0ac1672e1a4b7277145d88505f04f6ce342f208 /bfd | |
parent | feceaa596ebd1da9d8315c8ce74e45df4384da15 (diff) | |
download | gdb-8df73d5cc3a87101f3bd254f33820fcce61bc971.zip gdb-8df73d5cc3a87101f3bd254f33820fcce61bc971.tar.gz gdb-8df73d5cc3a87101f3bd254f33820fcce61bc971.tar.bz2 |
PR23781, _bfd_pe_bfd_copy_private_bfd_data_common memory leak
PR 23781
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Free data
before returning.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/peXXigen.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5031fff..ab665ed 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2018-10-16 Alan Modra <amodra@gmail.com> + PR 23781 + * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Free data + before returning. + +2018-10-16 Alan Modra <amodra@gmail.com> + PR 23534 * init.c (bfd_init): Return an unsigned int. bfd-in2.h: Regenerate. diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 1645ef4..1271d4e 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -2993,6 +2993,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) "exceeds space left in section (%" PRIx64 ")"), obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size, (uint64_t) (section->size - (addr - section->vma))); + free (data); return FALSE; } /* PR 23110. */ @@ -3002,6 +3003,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) _bfd_error_handler (_("%pB: Data Directory size (%#lx) is negative"), obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size); + free (data); return FALSE; } @@ -3030,8 +3032,10 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) if (!bfd_set_section_contents (obfd, section, data, 0, section->size)) { _bfd_error_handler (_("failed to update file offsets in debug directory")); + free (data); return FALSE; } + free (data); } else if (section) { |