From 028249a50d1cf441fee30d156ab0dd84ae37e300 Mon Sep 17 00:00:00 2001 From: serb Date: Wed, 30 Jul 2014 00:00:22 +0400 Subject: [PATCH] 8048524: Memory leak in jdk/src/share/native/sun/awt/image/BufImgSurfaceData.c Reviewed-by: prr, serb Contributed-by: Anton Melnikov --- .../native/sun/awt/image/BufImgSurfaceData.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/share/native/sun/awt/image/BufImgSurfaceData.c b/src/share/native/sun/awt/image/BufImgSurfaceData.c index 6dc99aba2..e51f53a89 100644 --- a/src/share/native/sun/awt/image/BufImgSurfaceData.c +++ b/src/share/native/sun/awt/image/BufImgSurfaceData.c @@ -291,7 +291,12 @@ static ColorData *BufImg_SetupICM(JNIEnv *env, = (*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 @@ static ColorData *BufImg_SetupICM(JNIEnv *env, 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); } } -- GitLab