aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2024-05-25 12:28:52 -0400
committerAndrew MacLeod <amacleod@redhat.com>2024-05-25 21:30:18 -0400
commitf9810728cf42ea7c3d84198aa582e53cfb2302d1 (patch)
tree6405496d1734491cb469ddc5e974f47ee356d60b
parent3c7ae57e8824cd4807a25ce76f11e745ba830dc2 (diff)
downloadgcc-f9810728cf42ea7c3d84198aa582e53cfb2302d1.zip
gcc-f9810728cf42ea7c3d84198aa582e53cfb2302d1.tar.gz
gcc-f9810728cf42ea7c3d84198aa582e53cfb2302d1.tar.bz2
Delete gori_map during destruction of GORI.
Forgot to free the gori_mpa object when a gori object is freed. PR tree-optimization/115208 * value-query.cc (range_query::create_gori): Confirm gori_map is NULL. (range_query::destroy_gori): Free gori_map if one was allocated.
-rw-r--r--gcc/value-query.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index 0d0c0e8..556a0f3 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -188,6 +188,7 @@ void
range_query::create_gori (int not_executable_flag, int sw_max_edges)
{
gcc_checking_assert (m_gori == &default_gori);
+ gcc_checking_assert (m_map == NULL);
m_map = new gori_map ();
gcc_checking_assert (m_map);
m_gori = new gori_compute (*m_map, not_executable_flag, sw_max_edges);
@@ -199,6 +200,9 @@ range_query::destroy_gori ()
{
if (m_gori && m_gori != &default_gori)
delete m_gori;
+ if (m_map)
+ delete m_map;
+ m_map = NULL;
m_gori= &default_gori;
}