diff options
author | Nick Clifton <nickc@redhat.com> | 2019-01-04 12:11:51 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2019-01-04 12:11:51 +0000 |
commit | cf0ad5bbf2d3fdb751b5f3f49e55d251d48c7416 (patch) | |
tree | 30a597593dc59479b52fcdfa707690be61236ffd /binutils/objcopy.c | |
parent | 677bd4c69d0eda4f2ae635d793f23c0b1413a9e9 (diff) | |
download | gdb-cf0ad5bbf2d3fdb751b5f3f49e55d251d48c7416.zip gdb-cf0ad5bbf2d3fdb751b5f3f49e55d251d48c7416.tar.gz gdb-cf0ad5bbf2d3fdb751b5f3f49e55d251d48c7416.tar.bz2 |
Fix ridiculously small memory leak.
PR 24001
* objcopy.c (copy_object): Free dhandle after writing out the
debug information.
* objdump.c (dump_bfd): Free dhandle after printing out the debug
information.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 9bc1230..0e17b86 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -3087,7 +3087,14 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) if (convert_debugging && dhandle != NULL) { - if (! write_debugging_info (obfd, dhandle, &symcount, &osympp)) + bfd_boolean res; + + res = write_debugging_info (obfd, dhandle, &symcount, &osympp); + + free (dhandle); + dhandle = NULL; /* Paranoia... */ + + if (! res) { status = 1; return FALSE; |