Commit 36b78328 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Fix initialization of cpuData structure. Closes #159.

parent 430c7c9a
...@@ -63,7 +63,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) { ...@@ -63,7 +63,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
fclose(file); fclose(file);
this->cpuCount = MAX(cpus - 1, 1); this->cpuCount = MAX(cpus - 1, 1);
this->cpus = realloc(this->cpus, cpus * sizeof(CPUData)); this->cpus = calloc(cpus, sizeof(CPUData));
for (int i = 0; i < cpus; i++) { for (int i = 0; i < cpus; i++) {
this->cpus[i].totalTime = 1; this->cpus[i].totalTime = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment