From: Cristy Date: Fri, 16 Feb 2018 11:47:56 +0000 (-0500) Subject: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6400 X-Git-Tag: 7.0.7-23~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b38c7af73d4a681c01d81ae0650b492682954547;p=imagemagick https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6400 --- diff --git a/MagickCore/distort.c b/MagickCore/distort.c index cc0fe5bf7..42ec9c659 100644 --- a/MagickCore/distort.c +++ b/MagickCore/distort.c @@ -798,6 +798,7 @@ static double *GenerateCoefficients(const Image *image, /* 8x8 least-squares matrix (zeroed) */ matrix = AcquireMagickMatrix(8UL,8UL); if (matrix == (double **) NULL) { + coeff=(double *) RelinquishMagickMemory(coeff); (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed", "%s", "DistortCoefficients"); @@ -855,6 +856,7 @@ static double *GenerateCoefficients(const Image *image, Arguments: Perspective Coefficents (forward mapping) */ if (number_arguments != 8) { + coeff = (double *) RelinquishMagickMemory(coeff); (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "InvalidArgument", "%s : 'Needs 8 coefficient values'", CommandOptionToMnemonic(MagickDistortOptions, *method)); @@ -2276,6 +2278,7 @@ MagickExport Image *DistortImage(const Image *image, DistortMethod method, /* if image is ColorMapped - change it to DirectClass */ if (SetImageStorageClass(distort_image,DirectClass,exception) == MagickFalse) { + coeff = (double *) RelinquishMagickMemory(coeff); distort_image=DestroyImage(distort_image); return((Image *) NULL); }