OSDN Git Service

PR 9735
authorAlan Modra <amodra@bigpond.net.au>
Tue, 13 Jan 2009 23:44:45 +0000 (23:44 +0000)
committerAlan Modra <amodra@bigpond.net.au>
Tue, 13 Jan 2009 23:44:45 +0000 (23:44 +0000)
* syms.c (_bfd_stab_section_find_nearest_line): Don't free
saved filename, use bfd_alloc rather than bfd_malloc for it.

bfd/ChangeLog
bfd/syms.c

index c6878ac..e45d262 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-14  Alan Modra  <amodra@bigpond.net.au>
+
+       PR 9735
+       * syms.c (_bfd_stab_section_find_nearest_line): Don't free
+       saved filename, use bfd_alloc rather than bfd_malloc for it.
+
 2009-01-13  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-spu.c (spu_elf_build_stubs): Make __icache_base absolute.
index 9a7cbda..cdbf905 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic symbol-table support for the BFD library.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2007, 2008
+   2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -1376,10 +1376,11 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
        {
          size_t len;
 
-         if (info->filename != NULL)
-           free (info->filename);
+         /* Don't free info->filename here.  objdump and other
+            apps keep a copy of a previously returned file name
+            pointer.  */
          len = strlen (file_name) + 1;
-         info->filename = bfd_malloc (dirlen + len);
+         info->filename = bfd_alloc (abfd, dirlen + len);
          if (info->filename == NULL)
            return FALSE;
          memcpy (info->filename, directory_name, dirlen);