changeset 13020:40cb3080b3dd

8140649: imageFile should use delete[] with new[] Reviewed-by: jlaskey
author asmotrak
date Mon, 09 Nov 2015 13:58:10 +0300
parents 612588a68bd3
children 7ad9bc01099b
files src/java.base/share/native/libjimage/imageFile.cpp
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/native/libjimage/imageFile.cpp	Mon Nov 09 09:23:49 2015 +0100
+++ b/src/java.base/share/native/libjimage/imageFile.cpp	Mon Nov 09 13:58:10 2015 +0300
@@ -118,7 +118,7 @@
     // Deflate the attribute stream into an array of attributes.
     u1 byte;
     // Repeat until end header is found.
-    while ((byte = *data)) {
+    while ((data != NULL) && (byte = *data)) {
         // Extract kind from header byte.
         u1 kind = attribute_kind(byte);
         assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
@@ -191,7 +191,7 @@
 // Release module data resource.
 ImageModuleData::~ImageModuleData() {
     if (_data) {
-        delete _data;
+        delete[] _data;
     }
 }
 
@@ -274,7 +274,7 @@
 }
 
 ImageFileReaderTable::~ImageFileReaderTable() {
-    delete _table;
+    delete[] _table;
 }
 
 // Add a new image entry to the table.
@@ -414,7 +414,7 @@
     close();
     // Free up name.
     if (_name) {
-        delete _name;
+        delete[] _name;
         _name = NULL;
     }
 }
@@ -668,7 +668,7 @@
                         &strings);
         // If not memory mapped then release temporary buffer.
         if (!MemoryMapImage) {
-                delete compressed_data;
+                delete[] compressed_data;
         }
     } else {
         // Read bytes from offset beyond the image index.