aboutsummaryrefslogtreecommitdiff
path: root/bfd/format.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-03-31 18:13:25 +0000
committerNick Clifton <nickc@redhat.com>2003-03-31 18:13:25 +0000
commit5ed6aba41c826194dcc97807392b22a3cefa1d7e (patch)
tree8e87d13436f477ba70e90e9109c69dcaf3d18e27 /bfd/format.c
parentee42cf8cc569b0ad926df63483075ccd868a10fa (diff)
downloadgdb-5ed6aba41c826194dcc97807392b22a3cefa1d7e.zip
gdb-5ed6aba41c826194dcc97807392b22a3cefa1d7e.tar.gz
gdb-5ed6aba41c826194dcc97807392b22a3cefa1d7e.tar.bz2
Fix memory leaks
Diffstat (limited to 'bfd/format.c')
-rw-r--r--bfd/format.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bfd/format.c b/bfd/format.c
index 9af6efc..655ccd9 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -163,7 +163,11 @@ bfd_check_format_matches (abfd, format, matching)
if (!abfd->target_defaulted)
{
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
- return FALSE;
+ {
+ if (matching)
+ free ((PTR) matching_vector);
+ return FALSE;
+ }
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -214,7 +218,11 @@ bfd_check_format_matches (abfd, format, matching)
abfd->xvec = *target; /* Change BFD's target temporarily. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
+ {
+ if (matching)
+ free ((PTR) matching_vector);
+ return FALSE;
+ }
/* If _bfd_check_format neglects to set bfd_error, assume
bfd_error_wrong_format. We didn't used to even pay any