提交 3233bc47 编写于 作者: J jgodinez

8005194: [parfait] #353 sun/awt/image/jpeg/imageioJPEG.c Memory leak of...

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
上级 c45a4f29
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册