Prevent malloc of size 0

This commit is contained in:
Armin Novak 2018-02-09 11:41:53 +01:00
parent 8c7fe93cc6
commit 50c7777bbb

View File

@ -332,7 +332,9 @@ int zgfx_decompress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, BY
if (!zgfx_decompress_segment(zgfx, stream, Stream_GetRemainingLength(stream)))
goto fail;
*ppDstData = (BYTE*) malloc(zgfx->OutputCount);
*ppDstData = NULL;
if (zgfx->OutputCount > 0)
*ppDstData = (BYTE*) malloc(zgfx->OutputCount);
if (!*ppDstData)
goto fail;