From 5ed6aba41c826194dcc97807392b22a3cefa1d7e Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 31 Mar 2003 18:13:25 +0000 Subject: Fix memory leaks --- bfd/format.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bfd/format.c') 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 -- cgit v1.1