diff mbox series

[committed] Fortran: fix frontend memleak

Message ID trinity-ba09bee1-67e6-4c7b-8e37-beb5f5e295b6-1715543901388@3c-app-gmx-bap07
State New
Headers show
Series [committed] Fortran: fix frontend memleak | expand

Commit Message

Harald Anlauf May 12, 2024, 7:58 p.m. UTC
Dear all,

the attached obvious patch fixes a frontend memleak that was introduced
recently, and which shows up when checking for inquiry references.
I came across it when working on pr115039.

Committed after regtesting as r15-391-g13b6ac4ebd04f0.

Thanks,
Harald
diff mbox series

Patch

From 13b6ac4ebd04f0703d92828c9268b0b216890b0d Mon Sep 17 00:00:00 2001
From: Harald Anlauf <anlauf@gmx.de>
Date: Sun, 12 May 2024 21:48:03 +0200
Subject: [PATCH] Fortran: fix frontend memleak

gcc/fortran/ChangeLog:

	* primary.cc (gfc_match_varspec): Replace 'ref' argument to
	is_inquiry_ref() by NULL when the result is not needed to avoid
	a memleak.
---
 gcc/fortran/primary.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 606e84432be..8e7833769a8 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -2250,7 +2250,7 @@  gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
 	 can be found.  If this was an inquiry reference with the same name
 	 as a derived component and the associate-name type is not derived
 	 or class, this is fixed up in 'gfc_fixup_inferred_type_refs'.  */
-      if (mm == MATCH_YES && is_inquiry_ref (name, &tmp)
+      if (mm == MATCH_YES && is_inquiry_ref (name, NULL)
 	  && !(sym->ts.type == BT_UNKNOWN
 		&& gfc_find_derived_types (sym, gfc_current_ns, name)))
 	inquiry = true;
--
2.35.3