[binutils-gdb] vms-alpha: Free memory on failure path

Alan Modra amodra@sourceware.org
Thu Aug 31 12:13:55 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad4ee59eb7d3cb3e02823c1ada571632c5b7891e

commit ad4ee59eb7d3cb3e02823c1ada571632c5b7891e
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Aug 31 18:40:40 2023 +0930

    vms-alpha: Free memory on failure path
    
            * vms-alpha.c (evax_bfd_print_eobj): Free rec on failure.

Diff:
---
 bfd/vms-alpha.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index f4d1e009d06..9689dcb8738 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -6972,6 +6972,7 @@ evax_bfd_print_eobj (struct bfd *abfd, FILE *file)
 	  != pad_len - hdr_size)
 	{
 	  fprintf (file, _("cannot read GST record\n"));
+	  free (rec);
 	  return;
 	}
 
@@ -6987,7 +6988,6 @@ evax_bfd_print_eobj (struct bfd *abfd, FILE *file)
 	  evax_bfd_print_eeom (file, rec, rec_len);
 	  free (rec);
 	  return;
-	  break;
 	case EOBJ__C_ETIR:
 	  evax_bfd_print_etir (file, "ETIR", rec, rec_len);
 	  break;


More information about the Binutils-cvs mailing list