mmkubernetes bugfix: improper use of calloc()

can cause problems under extreme memory shortage - very unlikely

credits to LGTM.COM for detecting this
This commit is contained in:
Rainer Gerhards 2019-10-16 17:39:42 +02:00
parent 72e069a8a6
commit 1aea234ac7
No known key found for this signature in database
GPG Key ID: 0CB6B2A8BE80B499

View File

@ -1508,8 +1508,9 @@ CODESTARTnewActInst
pData->cache = caches[i];
} else {
CHKmalloc(pData->cache = cacheNew(pData));
CHKmalloc(caches = realloc(caches, (i + 2) * sizeof(struct cache_s *)));
struct cache_s **new_caches = realloc(caches, (i + 2) * sizeof(struct cache_s *));
CHKmalloc(new_caches);
caches = new_caches;
caches[i] = pData->cache;
caches[i + 1] = NULL;
}