From: Martin Liska Date: Thu, 27 Jun 2019 08:21:32 +0000 (+0200) Subject: Fix misc stuff seen by clang-static-analyzer. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2f7a665a184e4ff00a6ac3fc147f63f276cc5a5;p=gcc.git Fix misc stuff seen by clang-static-analyzer. 2019-06-27 Martin Liska * 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 * libgcov-util.c (gcov_profile_merge): Release allocated memory. (calculate_overlap): Likewise. From-SVN: r272733 --- diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 95b98ab8664..ad14ac6ce5c 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,11 @@ +2019-06-27 Martin Liska + + * 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 * lto-common.c (compare_tree_sccs_1): Compare CXX_ODR_P; diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c index 691d109ff34..e9de33cf5d8 100644 --- a/gcc/lto/lto-dump.c +++ b/gcc/lto/lto-dump.c @@ -44,6 +44,9 @@ struct symbol_entry symbol_entry (symtab_node *node_): node (node_) {} + virtual ~symbol_entry () + {} + char* get_name () const { if (flag_lto_dump_demangle) @@ -72,6 +75,9 @@ struct variable_entry: public symbol_entry variable_entry (varpool_node *node_): symbol_entry (node_) {} + virtual ~variable_entry () + {} + virtual size_t get_size () const { varpool_node *vnode = dyn_cast (node); @@ -99,6 +105,9 @@ struct function_entry: public symbol_entry function_entry (cgraph_node *node_): symbol_entry (node_) {} + virtual ~function_entry () + {} + virtual void dump () { symbol_entry :: dump (); @@ -166,7 +175,10 @@ void dump_list_functions (void) int i=0; symbol_entry* e; FOR_EACH_VEC_ELT (v, i, e) - e->dump (); + { + e->dump (); + delete e; + } } /* Dump list of variables and their details. */ @@ -194,7 +206,10 @@ void dump_list_variables (void) int i=0; symbol_entry* e; FOR_EACH_VEC_ELT (v, i, e) - e->dump (); + { + e->dump (); + delete e; + } } /* Dump symbol list. */ diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index a6e8c202b9d..fa8230629f6 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-27 Martin Liska + + * libgcov-util.c (gcov_profile_merge): Release allocated + memory. + (calculate_overlap): Likewise. + 2019-06-25 Iain Sandoe * config.host: Add libef_ppc.a to the extra files for powerpc-darwin. diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c index c794132c172..404ece6faa6 100644 --- a/libgcc/libgcov-util.c +++ b/libgcc/libgcov-util.c @@ -681,6 +681,9 @@ gcov_profile_merge (struct gcov_info *tgt_profile, struct gcov_info *src_profile tgt_tail = gi_ptr; } + free (in_src_not_tgt); + free (tgt_infos); + return 0; } @@ -1280,6 +1283,8 @@ calculate_overlap (struct gcov_info *gcov_list1, } + free (all_infos); + if (overlap_obj_level) printf(" SUM:%36s overlap = %6.2f%% (%5.2f%% %5.2f%%)\n", "", sum_val*100, sum_cum_1*100, sum_cum_2*100);