Fix misc stuff seen by clang-static-analyzer.

2019-06-27  Martin Liska  <mliska@suse.cz>

	* lto-dump.c (struct symbol_entry): Add default dtor.
	(struct variable_entry): Likewise.
	(struct function_entry): Likewise.
	(dump_list_functions): Release memory.
	(dump_list_variables): Likewise.
2019-06-27  Martin Liska  <mliska@suse.cz>

	* libgcov-util.c (gcov_profile_merge): Release allocated
	memory.
	(calculate_overlap): Likewise.

From-SVN: r272733
This commit is contained in:
Martin Liska 2019-06-27 10:21:32 +02:00 committed by Martin Liska
parent b5b31291bd
commit c2f7a665a1
4 changed files with 36 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2019-06-27 Martin Liska <mliska@suse.cz>
* lto-dump.c (struct symbol_entry): Add default dtor.
(struct variable_entry): Likewise.
(struct function_entry): Likewise.
(dump_list_functions): Release memory.
(dump_list_variables): Likewise.
2019-06-24 Jan Hubicka <jh@suse.cz> 2019-06-24 Jan Hubicka <jh@suse.cz>
* lto-common.c (compare_tree_sccs_1): Compare CXX_ODR_P; * lto-common.c (compare_tree_sccs_1): Compare CXX_ODR_P;

View File

@ -44,6 +44,9 @@ struct symbol_entry
symbol_entry (symtab_node *node_): node (node_) symbol_entry (symtab_node *node_): node (node_)
{} {}
virtual ~symbol_entry ()
{}
char* get_name () const char* get_name () const
{ {
if (flag_lto_dump_demangle) if (flag_lto_dump_demangle)
@ -72,6 +75,9 @@ struct variable_entry: public symbol_entry
variable_entry (varpool_node *node_): symbol_entry (node_) variable_entry (varpool_node *node_): symbol_entry (node_)
{} {}
virtual ~variable_entry ()
{}
virtual size_t get_size () const virtual size_t get_size () const
{ {
varpool_node *vnode = dyn_cast<varpool_node *> (node); varpool_node *vnode = dyn_cast<varpool_node *> (node);
@ -99,6 +105,9 @@ struct function_entry: public symbol_entry
function_entry (cgraph_node *node_): symbol_entry (node_) function_entry (cgraph_node *node_): symbol_entry (node_)
{} {}
virtual ~function_entry ()
{}
virtual void dump () virtual void dump ()
{ {
symbol_entry :: dump (); symbol_entry :: dump ();
@ -166,7 +175,10 @@ void dump_list_functions (void)
int i=0; int i=0;
symbol_entry* e; symbol_entry* e;
FOR_EACH_VEC_ELT (v, i, e) FOR_EACH_VEC_ELT (v, i, e)
e->dump (); {
e->dump ();
delete e;
}
} }
/* Dump list of variables and their details. */ /* Dump list of variables and their details. */
@ -194,7 +206,10 @@ void dump_list_variables (void)
int i=0; int i=0;
symbol_entry* e; symbol_entry* e;
FOR_EACH_VEC_ELT (v, i, e) FOR_EACH_VEC_ELT (v, i, e)
e->dump (); {
e->dump ();
delete e;
}
} }
/* Dump symbol list. */ /* Dump symbol list. */

View File

@ -1,3 +1,9 @@
2019-06-27 Martin Liska <mliska@suse.cz>
* libgcov-util.c (gcov_profile_merge): Release allocated
memory.
(calculate_overlap): Likewise.
2019-06-25 Iain Sandoe <iain@sandoe.co.uk> 2019-06-25 Iain Sandoe <iain@sandoe.co.uk>
* config.host: Add libef_ppc.a to the extra files for powerpc-darwin. * config.host: Add libef_ppc.a to the extra files for powerpc-darwin.

View File

@ -681,6 +681,9 @@ gcov_profile_merge (struct gcov_info *tgt_profile, struct gcov_info *src_profile
tgt_tail = gi_ptr; tgt_tail = gi_ptr;
} }
free (in_src_not_tgt);
free (tgt_infos);
return 0; return 0;
} }
@ -1280,6 +1283,8 @@ calculate_overlap (struct gcov_info *gcov_list1,
} }
free (all_infos);
if (overlap_obj_level) if (overlap_obj_level)
printf(" SUM:%36s overlap = %6.2f%% (%5.2f%% %5.2f%%)\n", printf(" SUM:%36s overlap = %6.2f%% (%5.2f%% %5.2f%%)\n",
"", sum_val*100, sum_cum_1*100, sum_cum_2*100); "", sum_val*100, sum_cum_1*100, sum_cum_2*100);