changeset 1882:5fc5d3243a5c

6888215: memory leak in jpeg plugin Reviewed-by: igor, prr
author bae
date Fri, 23 Oct 2009 15:59:51 +0400
parents c579f8307707
children 1f2ef3a7d7c0
files src/share/native/sun/awt/image/jpeg/imageioJPEG.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Fri Oct 16 18:02:31 2009 -0700
+++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Fri Oct 23 15:59:51 2009 +0400
@@ -1437,6 +1437,7 @@
         JNU_ThrowByName( env,
                          "java/lang/OutOfMemoryError",
                          "Initializing Reader");
+        free(cinfo);
         return 0;
     }
 
@@ -1473,6 +1474,7 @@
         JNU_ThrowByName(env,
                         "java/lang/OutOfMemoryError",
                         "Initializing Reader");
+        imageio_dispose((j_common_ptr)cinfo);
         return 0;
     }
     cinfo->src->bytes_in_buffer = 0;
@@ -1489,6 +1491,7 @@
         JNU_ThrowByName( env,
                          "java/lang/OutOfMemoryError",
                          "Initializing Reader");
+        imageio_dispose((j_common_ptr)cinfo);
         return 0;
     }
     return (jlong) ret;
@@ -2420,8 +2423,7 @@
         JNU_ThrowByName( env,
                          "java/lang/OutOfMemoryError",
                          "Initializing Writer");
-        free(cinfo);
-        free(jerr);
+        imageio_dispose((j_common_ptr)cinfo);
         return 0;
     }
 
@@ -2439,8 +2441,7 @@
         JNU_ThrowByName( env,
                          "java/lang/OutOfMemoryError",
                          "Initializing Writer");
-        free(cinfo);
-        free(jerr);
+        imageio_dispose((j_common_ptr)cinfo);
         return 0;
     }
     return (jlong) ret;