< prev index next >

src/java.desktop/share/native/libsplashscreen/splashscreen_png.c

Print this page

        

@@ -46,12 +46,12 @@
 SplashDecodePng(Splash * splash, png_rw_ptr read_func, void *io_ptr)
 {
     int stride;
     ImageFormat srcFormat;
     png_uint_32 i, rowbytes;
-    png_bytepp row_pointers = NULL;
-    png_bytep image_data = NULL;
+    png_bytepp row_pointers;
+    png_bytep image_data;
     int success = 0;
     double gamma;
 
     png_structp png_ptr = NULL;
     png_infop info_ptr = NULL;

@@ -61,27 +61,36 @@
 
     ImageRect srcRect, dstRect;
 
     png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
     if (!png_ptr) {
+        row_pointers = NULL;
+        image_data = NULL;
         goto done;
     }
 
     info_ptr = png_create_info_struct(png_ptr);
     if (!info_ptr) {
+        row_pointers = NULL;
+        image_data = NULL;
         goto done;
     }
 
 #ifdef __APPLE__
     /* use setjmp/longjmp versions that do not save/restore the signal mask */
     if (_setjmp(png_set_longjmp_fn(png_ptr, _longjmp, sizeof(jmp_buf)))) {
 #else
     if (setjmp(png_jmpbuf(png_ptr))) {
 #endif
+        row_pointers = NULL;
+        image_data = NULL;
         goto done;
     }
 
+    row_pointers = NULL;
+    image_data = NULL;
+
     png_set_read_fn(png_ptr, io_ptr, read_func);
 
     png_set_sig_bytes(png_ptr, SIG_BYTES);      /* we already read the 8 signature bytes */
 
     png_read_info(png_ptr, info_ptr);   /* read all PNG info up to image data */
< prev index next >