From: cristy Date: Sun, 7 Oct 2012 20:39:52 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~4873 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65d161bca538bc1f5f7656d9b09233de414329e3;p=imagemagick --- diff --git a/MagickCore/fx.c b/MagickCore/fx.c index d601d368c..aa9fc31ae 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -2994,7 +2994,11 @@ static FxInfo **AcquireFxThreadSet(const Image *image,const char *expression, 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); @@ -3002,12 +3006,19 @@ static FxInfo **AcquireFxThreadSet(const Image *image,const char *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); } @@ -3032,9 +3043,6 @@ MagickExport Image *FxImage(const Image *image,const char *expression, MagickOffsetType progress; - double - alpha; - ssize_t y; @@ -3042,25 +3050,19 @@ MagickExport Image *FxImage(const Image *image,const char *expression, 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); } /*