8073699: Memory leak in jdk/src/java/desktop/share/native/libjavajpeg/imageioJPEG.c
Reviewed-by: bae, serb
--- a/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c Wed Feb 25 14:01:27 2015 +0300
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c Wed Feb 25 13:45:09 2015 -0800
@@ -2778,6 +2778,14 @@
pb = &data->pixelBuf;
if (setPixelBuffer(env, pb, buffer) == NOT_OK) {
+ if (scale != NULL) {
+ for (i = 0; i < numBands; i++) {
+ if (scale[i] != NULL) {
+ free(scale[i]);
+ }
+ }
+ free(scale);
+ }
return data->abortFlag; // We already threw an out of memory exception
}