Hi David,

thanks for your contribution. Your fixes look reasonable.
I'm forwarding your mail to to core-libs-dev and awt-dev for reviewing.

Regards,
Volker


---------- Forwarded message ----------
From: David CARLIER <devne...@gmail.com>
Date: Mon, Dec 5, 2016 at 10:10 PM
Subject: [PATCH]: few memory errors fixes
To: jdk9-...@openjdk.java.net


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.
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;
         }

Reply via email to