[fix][cximage] Set row_pointers to null after deletion. This fixes a crash.
authorace20022 <ace20022@ymail.com>
Sun, 14 Feb 2016 20:13:38 +0000 (21:13 +0100)
committerace20022 <ace20022@ymail.com>
Sun, 14 Feb 2016 20:13:38 +0000 (21:13 +0100)
lib/cximage-6.0/CxImage/ximapng.cpp

index adadeea..a58441c 100644 (file)
@@ -73,6 +73,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
 #endif
                /* Free all of the memory associated with the png_ptr and info_ptr */
                delete [] row_pointers;
+               row_pointers = nullptr;
                png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
                cx_throw("");
        }
@@ -467,6 +468,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
        }
 
        delete [] row_pointers;
+       row_pointers = nullptr;
 
        /* read the rest of the file, getting any additional chunks in info_ptr */
        png_read_end(png_ptr, info_ptr);
@@ -788,6 +790,7 @@ bool CxImagePNG::Encode(CxFile *hFile)
        }
 
        delete [] row_pointers;
+       row_pointers = nullptr;
 
        //if necessary, restore the original palette
        if (!bGrayScale && head.biClrUsed && info.nBkgndIndex>0)