jvmti.cc (_Jv_JVMTI_GetLocalVariableTable): Fix _Jv_Malloc parameters.

2007-03-06  Kyle Galloway  <kgallowa@redhat.com>
	* jvmti.cc(_Jv_JVMTI_GetLocalVariableTable): Fix _Jv_Malloc parameters.
	* testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
	(do_getlocalvartable_tests): Add Deallocate calls to free strings.

From-SVN: r122630
This commit is contained in:
Kyle Galloway 2007-03-06 18:22:28 +00:00 committed by Kyle Galloway
parent 4ba851b58b
commit 61a36e0df4
3 changed files with 18 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2007-03-06 Kyle Galloway <kgallowa@redhat.com>
* jvmti.cc(_Jv_JVMTI_GetLocalVariableTable): Fix _Jv_Malloc parameters.
* testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
(do_getlocalvartable_tests): Add Deallocate calls to free strings.
2007-03-05 Matthias Klose <doko@debian.org>
* Makefile.am (gij_LDFLAGS): Use dbexecdir.

View File

@ -997,23 +997,23 @@ _Jv_JVMTI_GetLocalVariableTable (MAYBE_UNUSED jvmtiEnv *env, jmethodID method,
table_slot)
>= 0)
{
char **str_ptr = &(*locals)[table_slot].name;
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
reinterpret_cast<unsigned char **>
(&(*locals)[table_slot].name));
reinterpret_cast<unsigned char **> (str_ptr));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].name, name);
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
reinterpret_cast<unsigned char **>
(&(*locals)[table_slot].signature));
str_ptr = &(*locals)[table_slot].signature;
jerr = env->Allocate (static_cast<jlong> (strlen (sig) + 1),
reinterpret_cast<unsigned char **> (str_ptr));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].signature, sig);
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
reinterpret_cast<unsigned char **>
(&(*locals)[table_slot].generic_signature));
str_ptr = &(*locals)[table_slot].generic_signature;
jerr = env->Allocate (static_cast<jlong> (strlen (generic_sig) + 1),
reinterpret_cast<unsigned char **> (str_ptr));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].generic_signature, generic_sig);

View File

@ -53,8 +53,11 @@ JNIEXPORT jint JNICALL Java_getlocalvartable_do_1getlocalvartable_1tests
{
printf ("Slot: %d\n", static_cast<int> (var_table[j].slot));
printf (" Name: %s\n", var_table[j].name);
jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table[j].name));
printf (" Sig: %s\n", var_table[j].signature);
jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table[j].signature));
printf (" Gen Sig: %s\n", var_table[j].generic_signature);
jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table[j].generic_signature));
printf (" Start Loc: %ld\n", static_cast<long> (var_table[j].start_location));
printf (" Length: %d\n", static_cast<int> (var_table[j].length));
}