SEGV in ppc64_elf_get_synthetic_symtab reading a separate debug file
[deliverable/binutils-gdb.git] / gdb / elfread.c
index 65c63f053868edb471e3ca2b89dcf2e59f8d9380..4a6576f80261317478077416b675e7988ca94694 100644 (file)
@@ -1144,8 +1144,10 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
 
   if (storage_needed > 0)
     {
-      symbol_table = (asymbol **) xmalloc (storage_needed);
-      make_cleanup (xfree, symbol_table);
+      /* Memory gets permanently referenced from ABFD after
+        bfd_canonicalize_symtab so it must not get freed before ABFD gets.  */
+
+      symbol_table = bfd_alloc (abfd, storage_needed);
       symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table);
 
       if (symcount < 0)
This page took 0.023171 seconds and 4 git commands to generate.