]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: Delete config pointer before overwriting it
authorMikael Morin <mikael@gcc.gnu.org>
Sat, 2 Sep 2023 10:55:25 +0000 (12:55 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Sat, 2 Sep 2023 10:55:25 +0000 (12:55 +0200)
Delete m_client_data_hooks before it is reassigned in
tree_diagnostics_defaults.  This fixes a small memory leak in the fortran
frontend, which restores the diagnostics configurations to their default
values with a call to tree_diagnostics_defaults at the end of the main parse
hook.

gcc/ChangeLog:

* tree-diagnostic.cc (tree_diagnostics_defaults): Delete allocated
pointer before overwriting it.

gcc/tree-diagnostic.cc

index 731e3559cd8151c9e49bd01c9e370267905a2b86..d2f6637b6d9561a4b786c6d96933473caff63075 100644 (file)
@@ -377,5 +377,6 @@ tree_diagnostics_defaults (diagnostic_context *context)
   context->print_path = default_tree_diagnostic_path_printer;
   context->make_json_for_path = default_tree_make_json_for_path;
   context->set_locations_cb = set_inlining_locations;
+  delete context->m_client_data_hooks;
   context->m_client_data_hooks = make_compiler_data_hooks ();
 }