Remove copy and leak of dex data.
To implement class redefinition we need to keep around a copy of the
initial redefinition. We moved this to be done in ArtClassDefinition
but left code that allocated and copied the buffer in RedefineClasses.
This code did nothing but leak memory.
Test: ./test.py --host
Change-Id: Ide5eafc7eda57eb5b1fc02eccb26091eacfae84f
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index 1476880..dd0428d 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -368,17 +368,6 @@
if (res != OK) {
return res;
}
- // We make a copy of the class_bytes to pass into the retransformation.
- // This makes cleanup easier (since we unambiguously own the bytes) and also is useful since we
- // will need to keep the original bytes around unaltered for subsequent RetransformClasses calls
- // to get the passed in bytes.
- unsigned char* class_bytes_copy = nullptr;
- res = env->Allocate(definitions[i].class_byte_count, &class_bytes_copy);
- if (res != OK) {
- return res;
- }
- memcpy(class_bytes_copy, definitions[i].class_bytes, definitions[i].class_byte_count);
-
ArtClassDefinition def;
res = def.Init(self, definitions[i]);
if (res != OK) {