8048524: Memory leak in jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c
authorserb
Wed, 30 Jul 2014 00:00:22 +0400
changeset 26015 627f46c41588
parent 26014 e50160ba221c
child 26016 d2c378099a3d
8048524: Memory leak in jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c Reviewed-by: prr, serb Contributed-by: Anton Melnikov <anton.melnikov@oracle.com>
jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c
--- a/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c	Tue Jul 29 15:03:05 2014 +0400
+++ b/jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c	Wed Jul 30 00:00:22 2014 +0400
@@ -291,7 +291,12 @@
             = (*env)->GetBooleanField(env, bisdo->icm, allGrayID);
         int *pRgb = (int *)
             ((*env)->GetPrimitiveArrayCritical(env, bisdo->lutarray, NULL));
-        CHECK_NULL_RETURN(pRgb, (ColorData*)NULL);
+
+        if (pRgb == NULL) {
+            free(cData);
+            return (ColorData*)NULL;
+        }
+
         cData->img_clr_tbl = initCubemap(pRgb, bisdo->lutsize, 32);
         if (allGray == JNI_TRUE) {
             initInverseGrayLut(pRgb, bisdo->lutsize, cData);
@@ -304,7 +309,13 @@
         if (JNU_IsNull(env, colorData)) {
             jlong pData = ptr_to_jlong(cData);
             colorData = (*env)->NewObjectA(env, clsICMCD, initICMCDmID, (jvalue *)&pData);
-            JNU_CHECK_EXCEPTION_RETURN(env, (ColorData*)NULL);
+
+            if ((*env)->ExceptionCheck(env))
+            {
+                free(cData);
+                return (ColorData*)NULL;
+            }
+
             (*env)->SetObjectField(env, bisdo->icm, colorDataID, colorData);
         }
     }