diff options
author | Alan Modra <amodra@gmail.com> | 2019-09-18 10:34:46 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-09-18 21:32:51 +0930 |
commit | 90d92a632aaf75ce698335efeb383ddf785c12d8 (patch) | |
tree | 66d29393e4100245fd03bfd25d97e98861772cf2 /ld | |
parent | PowerPC64, support medium model access to common symbols (diff) | |
download | binutils-gdb-90d92a632aaf75ce698335efeb383ddf785c12d8.tar.gz binutils-gdb-90d92a632aaf75ce698335efeb383ddf785c12d8.tar.bz2 binutils-gdb-90d92a632aaf75ce698335efeb383ddf785c12d8.zip |
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/ChangeLog | 5 | ||||
-rw-r--r-- | ld/emultempl/pe.em | 4 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index ea28a0b56fb..81935a408c5 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 49bb66b906a..2e78f26ad8b 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 4daa32b5c61..601ef11c201 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); |