]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: fix memory leaks
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 27 Jul 2022 21:38:53 +0000 (17:38 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 27 Jul 2022 21:54:12 +0000 (17:54 -0400)
commit1d38fa564edeae1e69e2ad8aa651e9452a6d687a
tree67a6c428de408cc4301934802073edf9475afc50
parent05530fcea07a9ee5c7501867f3f11f0fbc504a06
analyzer: fix memory leaks

(cherry picked from r13-334-g99988b0e8b57b3)

These leaks all relate to logging within -fdump-analyzer[-stderr]
or are one-time leaks; seen with valgrind.

gcc/analyzer/ChangeLog:
* checker-path.cc (state_change_event::get_desc): Call maybe_free
on label_text temporaries.
* diagnostic-manager.cc
(diagnostic_manager::prune_for_sm_diagnostic): Likewise.
* engine.cc (exploded_graph::~exploded_graph): Fix leak of
m_per_point_data and m_per_call_string_data values.  Simplify
cleanup of m_per_function_stats and m_per_point_data values.
(feasibility_state::maybe_update_for_edge): Fix leak of result of
superedge::get_description.
* region-model-manager.cc
(region_model_manager::~region_model_manager): Move cleanup of
m_setjmp_values to match the ordering of the fields within
region_model_manager.  Fix leak of values within
m_repeated_values_map, m_bits_within_values_map,
m_asm_output_values_map, and m_const_fn_result_values_map.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/checker-path.cc
gcc/analyzer/diagnostic-manager.cc
gcc/analyzer/engine.cc
gcc/analyzer/region-model-manager.cc