summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-05-24 12:57:41 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-06-22 21:58:48 -0400
commit980d19547fe3d4e3f03e7d0d35dd4c18b6aa6506 (patch)
tree34a1c8b39b66f4b3a19c7966b802a44f58cb2452 /rts
parentb7b7d90d0522e17f0401908e6a5649402a37a072 (diff)
downloadhaskell-980d19547fe3d4e3f03e7d0d35dd4c18b6aa6506.tar.gz
eventlog: Don't leave dangling pointers hanging around
Previously we failed to reset pointers to various eventlog buffers to NULL after freeing them. In principle we shouldn't look at them after they are freed but nevertheless it is good practice to set them to a well-defined value.
Diffstat (limited to 'rts')
-rw-r--r--rts/eventlog/EventLog.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index ba05f31591..0536ecdab6 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -454,6 +454,7 @@ finishCapEventLogging(void)
if (capEventBuf[c].begin != NULL) {
printAndClearEventBuf(&capEventBuf[c]);
stgFree(capEventBuf[c].begin);
+ capEventBuf[c].begin = NULL;
}
}
}
@@ -525,6 +526,7 @@ freeEventLoggingBuffer(void)
{
if (capEventBuf != NULL) {
stgFree(capEventBuf);
+ capEventBuf = NULL;
}
}