Added null check for issue reported in #792
diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c
index a3e972c..dee6c02 100644
--- a/MagickCore/opencl.c
+++ b/MagickCore/opencl.c
@@ -1249,8 +1249,13 @@
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)