vms-alpha: Free memory on failure path

Message ID ZPCD07YW+smBUGCd@squeak.grove.modra.org
State New
Headers
Series vms-alpha: Free memory on failure path |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_check--master-arm warning Patch is already merged

Commit Message

Alan Modra Aug. 31, 2023, 12:13 p.m. UTC
  * vms-alpha.c (evax_bfd_print_eobj): Free rec on failure.
  

Patch

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;