From: void0red <30990023+void0red@users.noreply.github.com> Date: Fri, 21 Jul 2023 04:17:03 +0000 (+0800) Subject: fileio_asyncio: handle malloc fails in AIO_ReadPool_create X-Git-Tag: v1.5.6^2~139^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3704%2Fhead;p=thirdparty%2Fzstd.git fileio_asyncio: handle malloc fails in AIO_ReadPool_create --- diff --git a/programs/fileio_asyncio.c b/programs/fileio_asyncio.c index fe9cca95d..dbf0c7564 100644 --- a/programs/fileio_asyncio.c +++ b/programs/fileio_asyncio.c @@ -551,6 +551,7 @@ ReadPoolCtx_t* AIO_ReadPool_create(const FIO_prefs_t* prefs, size_t bufferSize) AIO_IOPool_init(&ctx->base, prefs, AIO_ReadPool_executeReadJob, bufferSize); ctx->coalesceBuffer = (U8*) malloc(bufferSize * 2); + if(!ctx->coalesceBuffer) EXM_THROW(100, "Allocation error : not enough memory"); ctx->srcBuffer = ctx->coalesceBuffer; ctx->srcBufferLoaded = 0; ctx->completedJobsCount = 0;