mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-25 01:30:10 +00:00
8005194: [parfait] #353 sun/awt/image/jpeg/imageioJPEG.c Memory leak of pointer 'scale' allocated with calloc()
Reviewed-by: prr, vadim
This commit is contained in:
parent
78b547afa7
commit
fb6927c36c
@ -2694,6 +2694,11 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user