# HG changeset patch # User serb # Date 1406664022 -14400 # Node ID 627f46c415884f5bd6d45756bea96049001ddbc5 # Parent e50160ba221c4f5425057ac0f5aa8c39fba740de 8048524: Memory leak in jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c Reviewed-by: prr, serb Contributed-by: Anton Melnikov diff -r e50160ba221c -r 627f46c41588 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); } }