From ed37a6cf23d416505804b67438129856f5717c93 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 27 Nov 2015 09:36:52 +0100 Subject: [PATCH] Fix memory leaks in IPA devirt * ipa-devirt.c (ipa_devirt): Use auto_vec instead of a local-scope vec. (struct final_warning_record): Use auto_vec instead of vec. From-SVN: r230994 --- gcc/ChangeLog | 7 +++++++ gcc/ipa-devirt.c | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41ef7446e61..cdb47f93bdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-11-27 Martin Liska + + * ipa-devirt.c (ipa_devirt): Use auto_vec instead + of a local-scope vec. + (struct final_warning_record): Use auto_vec instead + of vec. + 2015-11-27 Richard Biener PR tree-optimization/68553 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index e74f85309ed..1539bb93906 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2987,7 +2987,7 @@ struct decl_warn_count struct final_warning_record { gcov_type dyn_count; - vec type_warnings; + auto_vec type_warnings; hash_map decl_warnings; }; struct final_warning_record *final_warning_records; @@ -3609,7 +3609,6 @@ ipa_devirt (void) if (warn_suggest_final_methods || warn_suggest_final_types) { final_warning_records = new (final_warning_record); - final_warning_records->type_warnings = vNULL; final_warning_records->type_warnings.safe_grow_cleared (odr_types.length ()); free_polymorphic_call_targets_hash (); } @@ -3837,7 +3836,7 @@ ipa_devirt (void) if (warn_suggest_final_methods) { - vec decl_warnings_vec = vNULL; + auto_vec decl_warnings_vec; final_warning_records->decl_warnings.traverse *, add_decl_warning> (&decl_warnings_vec); @@ -3887,7 +3886,7 @@ ipa_devirt (void) decl, count, dyn_count); } } - + delete (final_warning_records); final_warning_records = 0; } -- 2.30.2