From: Cristy Date: Sat, 24 Mar 2018 16:02:52 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/1037 X-Git-Tag: 7.0.7-28~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22434f81f83957be2f2263be33fdec18927939ce;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/1037 --- diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c index cd4377cc2..0aa3e3c7e 100644 --- a/MagickCore/opencl.c +++ b/MagickCore/opencl.c @@ -2736,11 +2736,13 @@ MagickPrivate MagickBooleanType RecordProfileData(MagickCLDevice device, name=DestroyString(name); else { - profile_record=AcquireMagickMemory(sizeof(*profile_record)); + profile_record=AcquireCriticalMemory(sizeof(*profile_record)); (void) memset(profile_record,0,sizeof(*profile_record)); profile_record->kernel_name=name; device->profile_records=ResizeMagickMemory(device->profile_records,(i+2)* sizeof(*device->profile_records)); + if (device->profile_records == (KernelProfileRecord *) NULL) + ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); device->profile_records[i]=profile_record; device->profile_records[i+1]=(KernelProfileRecord) NULL; }