From 22eec833cd72b5abab2627fcacc27d2dfb6aa6e7 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Wed, 4 Oct 2017 06:55:57 +0200 Subject: [PATCH] Added null check for issue reported in #792 --- MagickCore/opencl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c index a3e972cf4..dee6c021a 100644 --- a/MagickCore/opencl.c +++ b/MagickCore/opencl.c @@ -1249,8 +1249,13 @@ static void CacheOpenCLKernel(MagickCLDevice device,char *filename, CL_PROGRAM_BINARY_SIZES,sizeof(size_t),&binaryProgramSize,NULL); if (status != CL_SUCCESS) return; - binaryProgram=(unsigned char*) AcquireMagickMemory(binaryProgramSize); + if (binaryProgram == (unsigned char *) NULL) + { + (void) ThrowMagickException(exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'",filename); + return; + } status=openCL_library->clGetProgramInfo(device->program, CL_PROGRAM_BINARIES,sizeof(unsigned char*),&binaryProgram,NULL); if (status == CL_SUCCESS) -- 2.40.0