diff options
| author | 2015-07-31 17:22:26 +0200 | |
|---|---|---|
| committer | 2015-08-19 09:41:03 +0200 | |
| commit | 1ca062f21e466b5e8b5defe12033c65b2b4276cb (patch) | |
| tree | a144b8f89203259c497603a62db48fe857c90c3e | |
| parent | 158560ad66f860ab9bb822f98a0ef9cf3afa922f (diff) | |
zygote: fix memory leak when fork process
Release memory allocated by GetIntArrayElements.
Change-Id: If7ce2a78a480e58b0376352ce438dbe51f664f3a
| -rw-r--r-- | core/jni/com_android_internal_os_Zygote.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 2bfeadb18e20..adb19be94a98 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -356,8 +356,8 @@ static void DetachDescriptors(JNIEnv* env, jintArray fdsToClose) { return; } jsize count = env->GetArrayLength(fdsToClose); - jint *ar = env->GetIntArrayElements(fdsToClose, 0); - if (!ar) { + ScopedIntArrayRO ar(env, fdsToClose); + if (ar.get() == NULL) { ALOGE("Bad fd array"); RuntimeAbort(env); } |