mmkubernetes bugfix: improper use of calloc()

could cause problems under extreme memory shortage - very unlikely
credits to LGTM.COM for detecting this
This commit is contained in:
Rainer Gerhards 2019-10-17 12:03:37 +02:00
parent 716f4136e8
commit b4e625f074
No known key found for this signature in database
GPG Key ID: 0CB6B2A8BE80B499

View File

@ -952,8 +952,9 @@ growCompressCtx(wrkrInstanceData_t *pWrkrData, size_t newLen)
if (pWrkrData->compressCtx.buf == NULL) {
CHKmalloc(pWrkrData->compressCtx.buf = (uchar *)malloc(sizeof(uchar)*newLen));
} else {
CHKmalloc(pWrkrData->compressCtx.buf = (uchar *)realloc(pWrkrData->compressCtx.buf,
sizeof(uchar)*newLen));
uchar *const newbuf = (uchar *)realloc(pWrkrData->compressCtx.buf, sizeof(uchar)*newLen);
CHKmalloc(newbuf);
pWrkrData->compressCtx.buf = newbuf;
}
pWrkrData->compressCtx.len = newLen;
finalize_it: