number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
fx_info=(FxInfo **) AcquireQuantumMemory(number_threads,sizeof(*fx_info));
if (fx_info == (FxInfo **) NULL)
- return((FxInfo **) NULL);
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+ return((FxInfo **) NULL);
+ }
(void) ResetMagickMemory(fx_info,0,number_threads*sizeof(*fx_info));
if (*expression != '@')
fx_expression=ConstantString(expression);
fx_expression=FileToString(expression+1,~0,exception);
for (i=0; i < (ssize_t) number_threads; i++)
{
+ MagickBooleanType
+ status;
+
fx_info[i]=AcquireFxInfo(image,fx_expression,exception);
if (fx_info[i] == (FxInfo *) NULL)
- return(DestroyFxThreadSet(fx_info));
- (void) FxPreprocessExpression(fx_info[i],&alpha,fx_info[i]->exception);
+ break;
+ status=FxPreprocessExpression(fx_info[i],&alpha,exception);
+ if (status == MagickFalse)
+ break;
}
fx_expression=DestroyString(fx_expression);
+ if (i < (ssize_t) number_threads)
+ fx_info=DestroyFxThreadSet(fx_info);
return(fx_info);
}
MagickOffsetType
progress;
- double
- alpha;
-
ssize_t
y;
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ fx_info=AcquireFxThreadSet(image,expression,exception);
+ if (fx_info == (FxInfo **) NULL)
+ return((Image *) NULL);
fx_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
if (fx_image == (Image *) NULL)
- return((Image *) NULL);
- if (SetImageStorageClass(fx_image,DirectClass,exception) == MagickFalse)
{
- fx_image=DestroyImage(fx_image);
+ fx_info=DestroyFxThreadSet(fx_info);
return((Image *) NULL);
}
- fx_info=AcquireFxThreadSet(image,expression,exception);
- if (fx_info == (FxInfo **) NULL)
- {
- fx_image=DestroyImage(fx_image);
- ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
- }
- status=FxPreprocessExpression(fx_info[0],&alpha,exception);
- if (status == MagickFalse)
+ if (SetImageStorageClass(fx_image,DirectClass,exception) == MagickFalse)
{
- fx_image=DestroyImage(fx_image);
fx_info=DestroyFxThreadSet(fx_info);
+ fx_image=DestroyImage(fx_image);
return((Image *) NULL);
}
/*