diff options
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/jvmti.cc | 20 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc | 3 |
3 files changed, 18 insertions, 10 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 14fafff1fc0..b44c352d60e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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. diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index faa7401c1ce..068878793d5 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -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); diff --git a/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc b/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc index 3ca112d30f6..8899bac3b87 100644 --- a/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc +++ b/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc @@ -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)); } |