This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed, PATCH] mn10300: Don't free cached internal symbol table


Since ELF linker may cache internal symbol table in init_reloc_cookie,
we should check if it is cached, before free it.

	* elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
	isymbuf.
---
 bfd/ChangeLog    | 5 +++++
 bfd/elf-m10300.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c14a3bc491..81d27857fc 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-09  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
+	isymbuf.
+
+2017-10-09  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* elf32-bfin.c (bfin_size_dynamic_sections): Don't create the
 	.interp section with "ld --no-dynamic-linker".
 
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 9214a5745c..b5951c6005 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1377,7 +1377,7 @@ mn10300_elf_check_relocs (bfd *abfd,
 
   result = TRUE;
  fail:
-  if (isymbuf != NULL)
+  if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
     free (isymbuf);
 
   return result;
-- 
2.13.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]