FIX crash on exit with biographical profiling
[ghc-hetmet.git] / rts / ProfHeap.c
index 76a6b33..19abac7 100644 (file)
@@ -523,11 +523,13 @@ endHeapProfiling(void)
     }
 #endif
 
-    {
+    if (doingLDVProfiling()) {
         nat t;
-        for (t = 0; t <= era; t++) {
+        for (t = 1; t <= era; t++) {
             freeEra( &censuses[t] );
         }
+    } else {
+        freeEra( &censuses[0] );
     }
     stgFree(censuses);