changeset 10695:8c30e857e1d9

8073699: Memory leak in jdk/src/java/desktop/share/native/libjavajpeg/imageioJPEG.c Reviewed-by: bae, serb
author prr
date Mon, 20 Apr 2015 14:27:04 -0700
parents 88e71be7cc40
children 3f010f6ed280
files src/share/native/sun/awt/image/jpeg/imageioJPEG.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Mon Apr 20 15:00:09 2015 +0100
+++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Mon Apr 20 14:27:04 2015 -0700
@@ -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
     }