mirror of https://github.com/xzeldon/htop.git
Fix possible division by zero
Do not pass a nmemb of 0 to calloc, cause it's unportable and forbidden with our wrapper. Found by Coverity
This commit is contained in:
parent
2ec44098f9
commit
0f04714a03
|
@ -45,7 +45,7 @@ static void Settings_readMeterModes(Settings* this, const char* line, int column
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
this->columns[column].len = len;
|
this->columns[column].len = len;
|
||||||
int* modes = xCalloc(len, sizeof(int));
|
int* modes = len ? xCalloc(len, sizeof(int)) : NULL;
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
modes[i] = atoi(ids[i]);
|
modes[i] = atoi(ids[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue