Skip to content

Commit

Permalink
Added null check for issue reported in #792
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Lemstra committed Oct 4, 2017
1 parent ec21a6a commit 22eec83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MagickCore/opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 22eec83

Please sign in to comment.