This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix accesses to freed up memory in var-tracking (PR debug/53706)


Hi!

During htab_delete (dropped_values), loc_exp_dep_pool
allocated objects might be accessed, so it is better to free the
pool afterwards.

Bootstrapped/regtested on i686-linux, ok for trunk?

2012-06-21  Jakub Jelinek  <jakub@redhat.com>

	PR debug/53706
	* var-tracking.c (vt_emit_notes): Free loc_exp_dep_pool
	only after htab_delete call.

--- gcc/var-tracking.c.jj	2012-06-14 20:26:02.000000000 +0200
+++ gcc/var-tracking.c	2012-06-18 09:02:56.142742617 +0200
@@ -9127,9 +9127,9 @@ vt_emit_notes (void)
 
   if (MAY_HAVE_DEBUG_INSNS)
     {
+      htab_delete (dropped_values);
       free_alloc_pool (loc_exp_dep_pool);
       loc_exp_dep_pool = NULL;
-      htab_delete (dropped_values);
     }
 
   emit_notes = false;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]