From 72913831fc585ffa2bed866fb32532513ec10f8e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 30 Jan 2020 17:06:35 +1030 Subject: Remove need to clear obj_coff_keep_syms in coff object_p * coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms or obj_coff_keep_strings here. (coff_get_normalized_symtab): Free external syms directly. * xcofflink.c (xcoff_link_input_bfd): Restore obj_coff_keep_syms on error exit path. --- bfd/coffgen.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bfd/coffgen.c') diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 3ddd2d8..31e6fa7 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -302,14 +302,10 @@ 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: - obj_coff_keep_syms (abfd) = FALSE; - obj_coff_keep_strings (abfd) = FALSE; _bfd_coff_free_symbols (abfd); bfd_release (abfd, tdata); fail2: @@ -1877,10 +1873,13 @@ coff_get_normalized_symtab (bfd *abfd) } } - /* Free the raw symbols, but not the strings (if we have them). */ - obj_coff_keep_strings (abfd) = TRUE; - if (! _bfd_coff_free_symbols (abfd)) - return NULL; + /* Free the raw symbols. */ + if (obj_coff_external_syms (abfd) != NULL + && ! obj_coff_keep_syms (abfd)) + { + free (obj_coff_external_syms (abfd)); + obj_coff_external_syms (abfd) = NULL; + } for (internal_ptr = internal; internal_ptr < internal_end; internal_ptr++) -- cgit v1.1