From: Brian Demsky Date: Thu, 28 May 2020 19:54:52 +0000 (-0700) Subject: fix memory leak X-Git-Url: http://demsky.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=0636bb359706d39278eb31159aa612558784a22d fix memory leak --- diff --git a/datarace.cc b/datarace.cc index 28ebcf6d..cfbe94bf 100644 --- a/datarace.cc +++ b/datarace.cc @@ -143,6 +143,8 @@ static void expandRecord(uint64_t *shadow) ASSERT(readThread >= 0); record->thread[0] = readThread; record->readClock[0] = readClock; + } else { + record->thread = NULL; } if (shadowval & ATOMICMASK) record->isAtomic = 1; @@ -541,7 +543,7 @@ struct DataRace * fullRaceCheckRead(thread_id_t thread, const void *location, ui } if (__builtin_popcount(copytoindex) <= 1) { - if (copytoindex == 0) { + if (copytoindex == 0 && record->thread == NULL) { int newCapacity = INITCAPACITY; record->thread = (thread_id_t *)snapshot_malloc(sizeof(thread_id_t) * newCapacity); record->readClock = (modelclock_t *)snapshot_malloc(sizeof(modelclock_t) * newCapacity);