diff options
author | Nick Clifton <nickc@redhat.com> | 2018-07-20 15:05:34 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2018-07-20 15:05:34 +0100 |
commit | 3391569f218cd5d05e96769f47559d5828be3acd (patch) | |
tree | b5225952bb0f8f814014e1a1477f540f626be5d2 /binutils/objcopy.c | |
parent | 8095d2f70e1a982c006f306be1a9e1c892758914 (diff) | |
download | gdb-3391569f218cd5d05e96769f47559d5828be3acd.zip gdb-3391569f218cd5d05e96769f47559d5828be3acd.tar.gz gdb-3391569f218cd5d05e96769f47559d5828be3acd.tar.bz2 |
Close memory and resource leaks detected by coverity in the binutils directory.
* objcopy.c (add_specific_symbols): Free buffer on exit.
(add_redefine_syms_file): Close file handle on exit.
(copy_object): Close file handle on early exit.
Free buffer on early exit.
Free gaps buffers once they are no longer needed.
* dwarf.c (display_debug_frames): Free allocated memory on exit.
(load_separate_debug_info): Free allocate memory on early exit.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 3563792..25a88c9 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1142,6 +1142,8 @@ add_specific_symbols (const char *filename, htab_t htab) line = eol; line_count ++; } + + free (buffer); } /* See whether a symbol should be stripped or kept @@ -1817,6 +1819,7 @@ add_redefine_syms_file (const char *filename) fatal (_("%s:%d: premature end of file"), filename, lineno); free (buf); + fclose (file); } /* Copy unknown object file IBFD onto OBFD. @@ -2823,6 +2826,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) pdump->filename, strerror (errno)); free (contents); + fclose (f); return FALSE; } } @@ -3153,6 +3157,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) off, now)) { bfd_nonfatal_message (NULL, obfd, osections[i], NULL); + free (buf); return FALSE; } @@ -3161,6 +3166,10 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) } } } + + free (buf); + free (gaps); + gaps = NULL; } /* Allow the BFD backend to copy any private data it understands |