aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-18 10:34:46 +0930
committerAlan Modra <amodra@gmail.com>2019-09-18 21:32:51 +0930
commit90d92a632aaf75ce698335efeb383ddf785c12d8 (patch)
tree66d29393e4100245fd03bfd25d97e98861772cf2 /gdb
parent1bdd8facfbf6f94fa9603f528c7e8bdf91d90bfd (diff)
downloadgdb-90d92a632aaf75ce698335efeb383ddf785c12d8.zip
gdb-90d92a632aaf75ce698335efeb383ddf785c12d8.tar.gz
gdb-90d92a632aaf75ce698335efeb383ddf785c12d8.tar.bz2
Use bfd_set_filename more
Fixes a few leaks in bfd and ld. bfd/ * mach-o.c (bfd_mach_o_fat_member_init): Likewise. Replace xstrdup and xmalloc with bfd_strdup and bfd_malloc. Return an error status. Adjust calls. * vms-lib.c (_bfd_vms_lib_get_module): Test mhd->id earlier. Close bfd on failure. Replace xstrdup/bfd_alloc use with bfd_malloc. Use bfd_set_filename. gdb/ * solib-spu.c (spu_bfd_open): Use bfd_set_filename. * spu-linux-nat.c (spu_bfd_open): Likewise. ld/ * emultempl/pe.em (after_open): Use bfd_set_filename. * emultempl/pep.em (after_open): Use bfd_set_filename.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/solib-spu.c3
-rw-r--r--gdb/spu-linux-nat.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 39fcac7..9ad5000 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * solib-spu.c (spu_bfd_open): Use bfd_set_filename.
+ * spu-linux-nat.c (spu_bfd_open): Likewise.
+
2019-09-18 Christian Biesinger <cbiesinger@google.com>
* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 5b97b9b..c5e0aca 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -377,8 +377,7 @@ spu_bfd_open (const char *pathname)
strcat (buf, original_name);
- xfree ((char *)abfd->filename);
- abfd->filename = xstrdup (buf);
+ bfd_set_filename (abfd.get (), xstrdup (buf));
}
}
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 2f4b4d6..9dbb633 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -371,8 +371,7 @@ spu_bfd_open (ULONGEST addr)
sect_size - 20);
buf[sect_size - 20] = '\0';
- xfree ((char *)nbfd->filename);
- nbfd->filename = xstrdup (buf);
+ bfd_set_filename (nbfd.get (), xstrdup (buf));
}
}