From 0f04714a035e2024385237d5698ee9488f88a22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 25 Jan 2021 17:31:43 +0100 Subject: [PATCH] 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 --- Settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Settings.c b/Settings.c index 93e56f97..a2bb0962 100644 --- a/Settings.c +++ b/Settings.c @@ -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]); }