realloc doesn't guarantee zeroing...
authorBrian Demsky <bdemsky@uci.edu>
Thu, 1 Nov 2012 22:59:56 +0000 (15:59 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Thu, 1 Nov 2012 22:59:56 +0000 (15:59 -0700)
clockvector.cc

index 3363f7f..4dd03dc 100644 (file)
@@ -44,6 +44,8 @@ void ClockVector::merge(const ClockVector *cv)
 
        if (cv->num_threads > num_threads) {
                clock = (modelclock_t *)snapshot_realloc(clock, cv->num_threads * sizeof(modelclock_t));
 
        if (cv->num_threads > num_threads) {
                clock = (modelclock_t *)snapshot_realloc(clock, cv->num_threads * sizeof(modelclock_t));
+               for (int i= num_threads; i < cv->num_threads; i++)
+                       clock[i] = 0;
                num_threads = cv->num_threads;
        }
 
                num_threads = cv->num_threads;
        }