[PATCH]: few memory errors fixes

David CARLIER devnexen at gmail.com
Mon Dec 5 21:10:00 UTC 2016


Hi,

this is my first patch sent to the mailing list. One corrects the wrong
delete operator used and a potential memory leak.

Hope it is useful.

Kind regards.
-------------- next part --------------
diff --git a/src/java.base/share/native/libjimage/imageDecompressor.cpp b/src/java.base/share/native/libjimage/imageDecompressor.cpp
--- a/src/java.base/share/native/libjimage/imageDecompressor.cpp
+++ b/src/java.base/share/native/libjimage/imageDecompressor.cpp
@@ -181,7 +181,7 @@
         }
     } while (has_header);
     memcpy(uncompressed, decompressed_resource, (size_t) uncompressed_size);
-    delete decompressed_resource;
+    delete [] decompressed_resource;
 }
 
 // Zip decompressor
diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c
--- a/src/java.desktop/unix/native/common/awt/fontpath.c
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -289,6 +289,7 @@
         onePath = SAFE_SIZE_ARRAY_ALLOC(malloc, strlen (fDirP->name[index]) + 2, sizeof( char ) );
         if (onePath == NULL) {
             free ( ( void *) appendDirList );
+            free ( ( void *) newFontPath );
             XFreeFontPath ( origFontPath );
             return;
         }


More information about the jdk9-dev mailing list