8005921: Memory leaks in vmStructs.cpp
authordholmes
Thu, 10 Jan 2013 21:00:11 -0500
changeset 15190 a981848b466d
parent 15189 53ce4c2c2e8a
child 15192 f71a6fb9b532
8005921: Memory leaks in vmStructs.cpp Reviewed-by: dholmes, mikael, rasbold Contributed-by: Jeremy Manson <jeremymanson@google.com>
hotspot/src/share/vm/runtime/vmStructs.cpp
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Jan 10 17:06:26 2013 -0800
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Jan 10 21:00:11 2013 -0500
@@ -3112,10 +3112,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      delete s;
+      delete [] s;
       return 1;
     }
-    delete s;
+    delete [] s;
   }
   const char* start = NULL;
   if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3131,10 +3131,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      delete s;
+      delete [] s;
       return 1;
     }
-    delete s;
+    delete [] s;
   }
   if (strstr(typeName, "const ") == typeName) {
     const char * s = typeName + strlen("const ");
@@ -3148,8 +3148,10 @@
     s[len - 6] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
+      free(s);
       return 1;
     }
+    free(s);
   }
   if (!isRecurse) {
     tty->print_cr("type \"%s\" not found", typeName);