]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
backport 2009-01-14 Alan Modra <amodra@bigpond.net.au>
authorAlan Modra <amodra@gmail.com>
Mon, 2 Mar 2009 13:49:22 +0000 (13:49 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 2 Mar 2009 13:49:22 +0000 (13:49 +0000)
bfd/ChangeLog
bfd/syms.c

index d623ea59121f1c05290a1e144880f5f49bb14cdb..831b3960ddf29b78aaa3f8f029b297608b2c770a 100644 (file)
@@ -1,5 +1,10 @@
 2009-03-02  Alan Modra  <amodra@bigpond.net.au>
 
+       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-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
        * elflink.c (_bfd_elf_section_already_linked): Handle g++-3.4
        relocations in `.gnu.linkonce.r.*' referencing its `.gnu.linkonce.t.*'.
index 371916b9404d834e6356d21b88f0f27429c80c39..60d9af9aaf41a0b739e084c95eb382db7ffbaf71 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
+   2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -1379,10 +1379,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);