Fix memory leaks in IPA devirt
authorMartin Liska <mliska@suse.cz>
Fri, 27 Nov 2015 08:36:52 +0000 (09:36 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 27 Nov 2015 08:36:52 +0000 (08:36 +0000)
* 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
gcc/ipa-devirt.c

index 41ef7446e611df3fc6e48c461babfb4003dd6dc5..cdb47f93bdcba0bfca5cd87913ceeb33fbe58a69 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-27  Martin Liska  <mliska@suse.cz>
+
+       * 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  <rguenther@suse.de>
 
        PR tree-optimization/68553
index e74f85309ed49b8823860c6bd9c893ffc73fec18..1539bb93906396b2222413fbdaf182a224cc3a32 100644 (file)
@@ -2987,7 +2987,7 @@ struct decl_warn_count
 struct final_warning_record
 {
   gcov_type dyn_count;
-  vec<odr_type_warn_count> type_warnings;
+  auto_vec<odr_type_warn_count> type_warnings;
   hash_map<tree, decl_warn_count> 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<const decl_warn_count*> decl_warnings_vec = vNULL;
+         auto_vec<const decl_warn_count*> decl_warnings_vec;
 
          final_warning_records->decl_warnings.traverse
            <vec<const decl_warn_count *> *, 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;
     }