]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Wed, 27 Dec 2017 02:35:08 +0000 (21:35 -0500)
committerCristy <urban-warrior@imagemagick.org>
Wed, 27 Dec 2017 02:35:08 +0000 (21:35 -0500)
coders/pwp.c

index 1d9cbbf233d5ee990252d21fc4f2cbccc8f9b9cf..2d61a3bed005404cfb7729af31eb2abdbd767ea6 100644 (file)
@@ -193,11 +193,13 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if (c == EOF)
       {
         (void) RelinquishUniqueFileResource(read_info->filename);
+        read_info=DestroyImageInfo(read_info);
         ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");
       }
     if (LocaleNCompare((char *) (magick+12),"SFW94A",6) != 0)
       {
         (void) RelinquishUniqueFileResource(read_info->filename);
+        read_info=DestroyImageInfo(read_info);
         ThrowReaderException(CorruptImageError,"ImproperImageHeader");
       }
     /*
@@ -209,9 +211,10 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if ((unique_file == -1) || (file == (FILE *) NULL))
       {
         (void) RelinquishUniqueFileResource(read_info->filename);
+        read_info=DestroyImageInfo(read_info);
+        image=DestroyImageList(image);
         ThrowFileException(exception,FileOpenError,"UnableToWriteFile",
           image->filename);
-        image=DestroyImageList(image);
         return((Image *) NULL);
       }
     length=fwrite("SFW94A",1,6,file);
@@ -228,6 +231,7 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if (c == EOF)
       {
         (void) RelinquishUniqueFileResource(read_info->filename);
+        read_info=DestroyImageInfo(read_info);
         ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");
       }
     next_image=ReadImage(read_info,exception);