coff: free malloc'd memory on successful target match too

object_p functions cannot allocate memory by malloc and not free it
before returning.  Even a successful target match may not be the best
match.  If a match isn't used then those malloc'd blocks won't be
freed.

	* coffgen.c (coff_real_object_p): Free malloc'd memory on target
	match too.
This commit is contained in:
Alan Modra 2020-01-01 10:28:42 +10:30
parent 5ffd5873e6
commit 991fb595e3
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2020-01-04 Alan Modra <amodra@gmail.com>
* coffgen.c (coff_real_object_p): Free malloc'd memory on target
match too.
2020-01-03 Nick Clifton <nickc@redhat.com>
PR 25307

View File

@ -302,6 +302,9 @@ coff_real_object_p (bfd *abfd,
}
}
obj_coff_keep_syms (abfd) = FALSE;
obj_coff_keep_strings (abfd) = FALSE;
_bfd_coff_free_symbols (abfd);
return abfd->xvec;
fail: