]> granicus.if.org Git - imagemagick/commitdiff
Fixed memory leak (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7961).
authorDirk Lemstra <dirk@git.imagemagick.org>
Sat, 28 Apr 2018 10:31:04 +0000 (12:31 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sat, 28 Apr 2018 10:31:04 +0000 (12:31 +0200)
coders/rle.c

index 3da2a395f8ff5561a02a96d5cc1b45a4e1ad6e8c..583593a6ca258cfb76cfb3306ae33ff9d9970a3f 100644 (file)
@@ -318,7 +318,10 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
               ThrowRLEException(ResourceLimitError,"MemoryAllocationFailed");
             count=ReadBlob(image,length-1,(unsigned char *) comment);
             if (count != (length-1))
-              ThrowRLEException(CorruptImageError,"UnexpectedEndOfFile");
+              {
+                comment=DestroyString(comment);
+                ThrowRLEException(CorruptImageError,"UnexpectedEndOfFile");
+              }
             comment[length-1]='\0';
             (void) SetImageProperty(image,"comment",comment,exception);
             comment=DestroyString(comment);