diff options
author | Alan Modra <amodra@gmail.com> | 2023-02-12 22:34:27 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-02-13 12:53:31 +1030 |
commit | 3eef3b2c2d85bb0b83a4e902d4444400ddfde0ab (patch) | |
tree | 27eb69a964016a8289525ed81546aa32f38ed534 /binutils | |
parent | f6b9eb5e296da177a353b4b73239b80a0cd551a2 (diff) | |
download | gdb-3eef3b2c2d85bb0b83a4e902d4444400ddfde0ab.zip gdb-3eef3b2c2d85bb0b83a4e902d4444400ddfde0ab.tar.gz gdb-3eef3b2c2d85bb0b83a4e902d4444400ddfde0ab.tar.bz2 |
objcopy memory leaks
This fixes some objcopy memory leaks. commit 450da4bd38ae used
xatexit to tidy most of the hash table memory, but of course that's
ineffective without a call to xexit. The other major memory leak
happens if there is an error of some sort writing the output file, due
to not closing the input file and thus not freeing memory attached to
the bfd.
* objcopy.c (copy_file): Don't return when bfd_close of output
gives an error, always bfd_close input too.
(main): Call xexit.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/objcopy.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index eb2e54b..b9d946a 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -3934,14 +3934,12 @@ copy_file (const char *input_filename, const char *output_filename, int ofd, { status = 1; bfd_nonfatal_message (output_filename, NULL, NULL, NULL); - return; } if (!bfd_close (ibfd)) { status = 1; bfd_nonfatal_message (input_filename, NULL, NULL, NULL); - return; } } else @@ -6093,5 +6091,6 @@ main (int argc, char *argv[]) END_PROGRESS (program_name); + xexit (status); return status; } |