[Android] Fix local reference leak
Geoffrey Métais
git at videolan.org
Thu Apr 20 15:39:27 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 20 11:01:25 2017 +0200| [0da5a2c5986265f8c2c6a72809054db89f4b6fc8] | committer: Geoffrey Métais
Fix local reference leak
> https://code.videolan.org/videolan/vlc-android/commit/0da5a2c5986265f8c2c6a72809054db89f4b6fc8
---
medialibrary/jni/utils.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp
index eb2ba2d..b703d39 100644
--- a/medialibrary/jni/utils.cpp
+++ b/medialibrary/jni/utils.cpp
@@ -250,8 +250,10 @@ filteredArray(JNIEnv* env, fields *fields, jobjectArray array, int removalCount)
size = env->GetArrayLength(array);
for (int i = 0; i<size; ++i)
{
- if (env->GetObjectArrayElement(array, i) == nullptr)
+ jobject item = env->GetObjectArrayElement(array, i);
+ if (item == nullptr)
++removalCount;
+ env->DeleteLocalRef(item);
}
}
if (removalCount == 0)
More information about the Android
mailing list