aboutsummaryrefslogtreecommitdiff
path: root/ld
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 /ld
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 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/pe.em4
-rw-r--r--ld/emultempl/pep.em4
3 files changed, 9 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ea28a0b..81935a4 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * emultempl/pe.em (after_open): Use bfd_set_filename.
+ * emultempl/pep.em (after_open): Use bfd_set_filename.
+
2019-09-16 Alan Modra <amodra@gmail.com>
PR 25002
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 49bb66b..2e78f26 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1543,7 +1543,7 @@ gld_${EMULATION_NAME}_after_open (void)
/* Rename this implib to match the other one. */
n = xmalloc (strlen (other_bfd_filename) + 1);
strcpy (n, other_bfd_filename);
- is->the_bfd->my_archive->filename = n;
+ bfd_set_filename (is->the_bfd->my_archive, n);
}
free (relocs);
@@ -1648,7 +1648,7 @@ gld_${EMULATION_NAME}_after_open (void)
new_name = xmalloc (strlen (is->the_bfd->filename) + 3);
sprintf (new_name, "%s.%c", is->the_bfd->filename, seq);
- is->the_bfd->filename = new_name;
+ bfd_set_filename (is->the_bfd, new_name);
new_name = xmalloc (strlen (is->filename) + 3);
sprintf (new_name, "%s.%c", is->filename, seq);
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 4daa32b..601ef11 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1510,7 +1510,7 @@ gld_${EMULATION_NAME}_after_open (void)
/* Rename this implib to match the other one. */
n = xmalloc (strlen (other_bfd_filename) + 1);
strcpy (n, other_bfd_filename);
- is->the_bfd->my_archive->filename = n;
+ bfd_set_filename (is->the_bfd->my_archive, n);
}
free (relocs);
@@ -1615,7 +1615,7 @@ gld_${EMULATION_NAME}_after_open (void)
new_name = xmalloc (strlen (is->the_bfd->filename) + 3);
sprintf (new_name, "%s.%c", is->the_bfd->filename, seq);
- is->the_bfd->filename = new_name;
+ bfd_set_filename (is->the_bfd, new_name);
new_name = xmalloc (strlen (is->filename) + 3);
sprintf (new_name, "%s.%c", is->filename, seq);