hotspot/src/share/vm/runtime/arguments.cpp
changeset 17321 4c3374b41dbd
parent 17098 7aa4c9e7f85b
parent 17319 7704ecd22af4
child 17322 35c488005999
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri May 03 08:19:38 2013 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon May 06 13:03:46 2013 +0200
@@ -747,16 +747,16 @@
     return;
   }
 
-  int index = *count;
+  int new_count = *count + 1;
 
   // expand the array and add arg to the last element
-  (*count)++;
   if (*bldarray == NULL) {
-    *bldarray = NEW_C_HEAP_ARRAY(char*, *count, mtInternal);
+    *bldarray = NEW_C_HEAP_ARRAY(char*, new_count, mtInternal);
   } else {
-    *bldarray = REALLOC_C_HEAP_ARRAY(char*, *bldarray, *count, mtInternal);
+    *bldarray = REALLOC_C_HEAP_ARRAY(char*, *bldarray, new_count, mtInternal);
   }
-  (*bldarray)[index] = strdup(arg);
+  (*bldarray)[*count] = strdup(arg);
+  *count = new_count;
 }
 
 void Arguments::build_jvm_args(const char* arg) {