changeset 11498:b7e402c9b183

8073699: Memory leak in jdk/src/java/desktop/share/native/libjavajpeg/imageioJPEG.c Reviewed-by: bae, serb
author prr
date Wed, 25 Feb 2015 13:45:09 -0800
parents 95d83afafcb1
children c0d81dd14d61
files src/java.desktop/share/native/libjavajpeg/imageioJPEG.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Wed Feb 25 14:01:27 2015 +0300
+++ b/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
     }