changeset 13672:505cc1a86ea7

8146249: libjimage should use delete[] with new[] Reviewed-by: jlaskey
author asmotrak
date Tue, 02 Feb 2016 12:50:03 -0800
parents 00821d616077
children 0419817f770b
files src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp src/java.base/share/native/libjimage/imageDecompressor.cpp
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp	Tue Feb 02 11:50:55 2016 -0800
+++ b/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp	Tue Feb 02 12:50:03 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -210,7 +210,7 @@
     // Locate resource location data.
     ImageLocation location;
     bool found = reader->find_location(path, location);
-    delete path;
+    delete[] path;
     // Resource not found.
     if (!found) return NULL;
     // Expand stream into array.
--- a/src/java.base/share/native/libjimage/imageDecompressor.cpp	Tue Feb 02 11:50:55 2016 -0800
+++ b/src/java.base/share/native/libjimage/imageDecompressor.cpp	Tue Feb 02 12:50:03 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
 }
 
 void ImageDecompressor::image_decompressor_close() {
-    delete _decompressors;
+    delete[] _decompressors;
 }
 
 /*
@@ -135,13 +135,13 @@
             decompressor->decompress_resource(compressed_resource, decompressed_resource,
                 &_header, strings);
             if (compressed_resource_base != compressed) {
-                delete compressed_resource_base;
+                delete[] compressed_resource_base;
             }
             compressed_resource = decompressed_resource;
         }
     } while (has_header);
     memcpy(uncompressed, decompressed_resource, uncompressed_size);
-    delete decompressed_resource;
+    delete[] decompressed_resource;
 }
 
 // Zip decompressor
@@ -241,7 +241,7 @@
                                 *fullpkg = '/';
                                 memcpy(uncompressed_resource, pkg_base, len);
                                 uncompressed_resource += len;
-                                delete pkg_base;
+                                delete[] pkg_base;
                                 desc_length += len;
                             } else { // Empty package
                                 // Nothing to do.