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:
Christian Göttsche 2021-01-25 17:31:43 +01:00
parent 2ec44098f9
commit 0f04714a03
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ static void Settings_readMeterModes(Settings* this, const char* line, int column
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++) {
modes[i] = atoi(ids[i]);
}