From 4d267f3d4f9f85eecf98d1a2353408b8e840f1a3 Mon Sep 17 00:00:00 2001 From: void0red <30990023+void0red@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:17:03 +0800 Subject: [PATCH] fileio_asyncio: handle malloc fails in AIO_ReadPool_create --- programs/fileio_asyncio.c | 1 + 1 file changed, 1 insertion(+) 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;