]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6400
authorCristy <urban-warrior@imagemagick.org>
Fri, 16 Feb 2018 11:47:56 +0000 (06:47 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 16 Feb 2018 11:48:17 +0000 (06:48 -0500)
MagickCore/distort.c

index cc0fe5bf7b4c864e035922ca54aa20615172505d..42ec9c659306c2a0f39210ae29ac3841d341674f 100644 (file)
@@ -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);
     }