]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fileio_asyncio: handle malloc fails in AIO_ReadPool_create 3704/head
authorvoid0red <30990023+void0red@users.noreply.github.com>
Fri, 21 Jul 2023 04:17:03 +0000 (12:17 +0800)
committerGitHub <noreply@github.com>
Fri, 21 Jul 2023 04:17:03 +0000 (12:17 +0800)
programs/fileio_asyncio.c

index fe9cca95d1f8af235bb926ae630d3d41d6962713..dbf0c7564147534ec06ec03432c59ba6b2ecd2a5 100644 (file)
@@ -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;