This is the mail archive of the mailing list for the GDB 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]

[PATCH] Fix copy of filename in bfd's filename field


in my recent tests, upstream gdb was crashing with the following:

$ ./gdb ./testsuite/gdb.base/break -q -ex run
Reading symbols from ./testsuite/gdb.base/break...done.
Starting program:
*** glibc detected *** ./gdb: double free or corruption (out): 0x088efc80 ***
======= Backtrace: =========

It was caused by this commit 1be509 on binutils code
which is now using xstrdup to store a copy of filename in bfd struct.

The patch below fixes this problem on gdb side. Ok?


2014-01-03  Edjunior Barbosa Machado  <>

	* gdb_bfd.c (gdb_bfd_stash_filename): Fix copy of filename in bfd's
	filename field using xstrdup.

 gdb/gdb_bfd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 36c4630..1b290c2 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -69,7 +69,7 @@ gdb_bfd_stash_filename (struct bfd *abfd)
   strcpy (data, name);
   /* Unwarranted chumminess with BFD.  */
-  abfd->filename = data;
+  abfd->filename = xstrdup (data);
 /* An object of this type is stored in each BFD's user data.  */

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