OSDN Git Service

Undecoded jobject leaking in through attachThread
authorMark Gordon <msg555@gmail.com>
Fri, 20 May 2011 21:18:36 +0000 (17:18 -0400)
committerMark Gordon <msg555@gmail.com>
Fri, 20 May 2011 21:18:36 +0000 (17:18 -0400)
Change-Id: I6b03227dc07d53862467395531b8dca07d2381ef

vm/Jni.c

index ef0749a..0c6509a 100644 (file)
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -566,6 +566,8 @@ static inline ReferenceTable* getLocalRefTable(JNIEnv* env)
  * reference may be local, global, or weak-global.
  *
  * If "jobj" is NULL or an invalid indirect reference, this returns NULL.
+ *
+ * Note "env" may be NULL when decoding global references.
  */
 Object* dvmDecodeIndirectRef(JNIEnv* env, jobject jobj)
 {
@@ -3856,7 +3858,7 @@ static jint attachThread(JavaVM* vm, JNIEnv** p_env, void* thr_args,
         argsCopy.version = args->version;
         argsCopy.name = args->name;
         if (args->group != NULL)
-            argsCopy.group = args->group;
+            argsCopy.group = dvmDecodeIndirectRef(NULL, args->group);
         else
             argsCopy.group = dvmGetMainThreadGroup();
     }