diff options
author | Alan Modra <amodra@gmail.com> | 2022-07-04 11:24:22 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-07-04 22:51:56 +0930 |
commit | 0772daccb3ebaf513badf4266e1948454b4455c1 (patch) | |
tree | 23032d204a77ac8f9c8cec3a0c48e0ee8b826548 /binutils/bucomm.h | |
parent | d8efadbdd94772562fed8fba9ce553587a62550f (diff) | |
download | gdb-0772daccb3ebaf513badf4266e1948454b4455c1.zip gdb-0772daccb3ebaf513badf4266e1948454b4455c1.tar.gz gdb-0772daccb3ebaf513badf4266e1948454b4455c1.tar.bz2 |
objcopy: bfd_alloc orelocation
This fixes an inconsequential objcopy memory leak. I'd normally
ignore reports of leaks like this one, that are merely one block or
fewer per section processed, since objcopy soon exits and frees all
memory. However I thought it worth providing support for allocating
memory on a bfd objalloc in objcopy and other utils.
PR 29233
* bucomm.c (bfd_xalloc): New function.
* bucomm.h (bfd_xalloc): Declare.
* objcopy.c (copy_relocations_in_section): Use it to allocate
array of reloc pointers. Rewrite code stripping relocs to do
without extra memory allocation.
Diffstat (limited to 'binutils/bucomm.h')
-rw-r--r-- | binutils/bucomm.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/binutils/bucomm.h b/binutils/bucomm.h index 48b2c50..a1814cb 100644 --- a/binutils/bucomm.h +++ b/binutils/bucomm.h @@ -39,6 +39,8 @@ void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1; +void *bfd_xalloc (bfd *, size_t); + void set_default_bfd_target (void); void list_matching_formats (char **); |