From 37d2e9c7b10e298403640fdd38a50fedae8525b2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sun, 29 Dec 2019 12:55:34 +1030 Subject: asan: alpha-vms: memory leaks * vms-misc.c (_bfd_vms_save_sized_string): Add abfd param, make size a size_t. Use bfd_alloc rather than bfd_malloc. (_bfd_vms_save_counted_string): Similarly. * vms.h (_bfd_vms_save_sized_string): Update prototype. (_bfd_vms_save_counted_string): Likewise. * vms-alpha.c (_bfd_vms_slurp_ehdr): Adjust _bfd_vms_save_counted_string and bfd_vms_save_sized_string calls. (_bfd_vms_slurp_egsd, parse_module): Likewise. (_bfd_vms_slurp_eisd): Likewise. Check return status. (alpha_vms_bfd_link_hash_table_free): New function. (alpha_vms_bfd_link_hash_table_create): Arrange to call it. (vms_close_and_cleanup): Free more memory. Don't release tdata. --- bfd/vms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bfd/vms.h') diff --git a/bfd/vms.h b/bfd/vms.h index 6c96b58..8df75b7 100644 --- a/bfd/vms.h +++ b/bfd/vms.h @@ -118,8 +118,8 @@ extern void vms_time_t_to_vms_time (time_t ut, unsigned int *hi, unsigned int *l extern void vms_get_time (unsigned int *hi, unsigned int *lo); extern void vms_raw_get_time (unsigned char *buf); -extern char * _bfd_vms_save_sized_string (unsigned char *, unsigned); -extern char * _bfd_vms_save_counted_string (unsigned char *, unsigned); +extern char * _bfd_vms_save_sized_string (bfd *, unsigned char *, size_t); +extern char * _bfd_vms_save_counted_string (bfd *, unsigned char *, size_t); extern void _bfd_vms_output_begin (struct vms_rec_wr *, int); extern void _bfd_vms_output_alignment (struct vms_rec_wr *, int); extern void _bfd_vms_output_begin_subrec (struct vms_rec_wr *, int); -- cgit v1.1