Mercurial > hg > release > icedtea7-forest-2.3 > jdk
changeset 6314:5438973623f2
8005194: [parfait] #353 sun/awt/image/jpeg/imageioJPEG.c Memory leak of pointer 'scale' allocated with calloc()
Reviewed-by: prr, vadim
Contributed-by: jia-hong.chen@oracle.com
author | jgodinez |
---|---|
date | Wed, 06 Feb 2013 14:45:02 -0800 |
parents | ba476cfdd27c |
children | 375646138f2e |
files | src/share/native/sun/awt/image/jpeg/imageioJPEG.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Fri Oct 04 16:36:56 2013 +0100 +++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Wed Feb 06 14:45:02 2013 -0800 @@ -2691,6 +2691,11 @@ scale[i] = (UINT8*) malloc((maxBandValue + 1) * sizeof(UINT8)); if (scale[i] == NULL) { + // Cleanup before throwing an out of memory exception + for (j = 0; j < i; j++) { + free(scale[j]); + } + free(scale); JNU_ThrowByName( env, "java/lang/OutOfMemoryError", "Writing JPEG Stream"); return JNI_FALSE;