Fix double-free in T5644 (#12208)
authorSimon Marlow <marlowsd@gmail.com>
Mon, 20 Jun 2016 12:33:13 +0000 (13:33 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 20 Jun 2016 14:00:22 +0000 (15:00 +0100)
rts/Schedule.c

index fca276d..d9ab913 100644 (file)
@@ -1867,8 +1867,6 @@ delete_threads_and_gc:
         }
         task->cap = cap;
     }
-
-    stgFree(idle_cap);
 #endif
 
     if (heap_overflow && sched_state < SCHED_INTERRUPTING) {
@@ -1897,6 +1895,8 @@ delete_threads_and_gc:
 #endif
 
 #if defined(THREADED_RTS)
+    stgFree(idle_cap);
+
     if (gc_type == SYNC_GC_SEQ) {
         // release our stash of capabilities.
         releaseAllCapabilities(n_capabilities, cap, task);