2007-03-06 Kyle Galloway <kgallowa@redhat.com>
authorkgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Mar 2007 18:22:28 +0000 (18:22 +0000)
committerkgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Mar 2007 18:22:28 +0000 (18:22 +0000)
* jvmti.cc(_Jv_JVMTI_GetLocalVariableTable): Fix _Jv_Malloc parameters.
* testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
(do_getlocalvartable_tests): Add Deallocate calls to free strings.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122630 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/jvmti.cc
libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc

index 14fafff..b44c352 100644 (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.
index faa7401..0688787 100644 (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);
index 3ca112d..8899bac 100644 (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));
             }