diff options
Diffstat (limited to 'gdb/symfile-mem.c')
-rw-r--r-- | gdb/symfile-mem.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 87808e31b92..e3230de85dc 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -101,14 +101,11 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name, error (_("Failed to read a valid object file image from memory.")); gdb_bfd_ref (nbfd); + xfree (bfd_get_filename (nbfd)); if (name == NULL) - nbfd->filename = "shared object read from target memory"; + nbfd->filename = xstrdup ("shared object read from target memory"); else - { - nbfd->filename = name; - gdb_bfd_stash_filename (nbfd); - xfree (name); - } + nbfd->filename = name; cleanup = make_cleanup_bfd_unref (nbfd); |