diff options
author | Alan Modra <amodra@gmail.com> | 2009-01-13 23:44:45 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2009-01-13 23:44:45 +0000 |
commit | 13c0e967803510ccb3f4f12237bc29acd1652fca (patch) | |
tree | 6faa3f3462888f6126dda1e9fe980c100cded93e /bfd/syms.c | |
parent | 84fcdf956814f0affad505dd335c3564dd28f471 (diff) | |
download | gdb-13c0e967803510ccb3f4f12237bc29acd1652fca.zip gdb-13c0e967803510ccb3f4f12237bc29acd1652fca.tar.gz gdb-13c0e967803510ccb3f4f12237bc29acd1652fca.tar.bz2 |
PR 9735
* syms.c (_bfd_stab_section_find_nearest_line): Don't free
saved filename, use bfd_alloc rather than bfd_malloc for it.
Diffstat (limited to 'bfd/syms.c')
-rw-r--r-- | bfd/syms.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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); |