summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-05-24 12:57:41 -0400
committerBen Gamari <ben@smart-cactus.org>2022-05-24 12:59:20 -0400
commit79bbbf0a3786f2bfeb0425437e16e89570bae03d (patch)
treeb65953130ba0e3d8ba33889054eca26d4b39492a
parent36b8a57cb30c1374cce749b6f1554a2d438336b9 (diff)
downloadhaskell-wip/eventlog-fixes.tar.gz
eventlog: Don't leave dangling pointers hanging aroundwip/eventlog-fixes
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.
-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 ff3229298c..0f10e9835e 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;
}
}