From 978cb0e884dea9be4d98a0b52ae930655f7d9ad8 Mon Sep 17 00:00:00 2001 From: sanikoyes Date: Mon, 11 Jul 2016 12:41:54 +0800 Subject: [PATCH] Fix crash in FileAccessJAndroid::file_exists (does not free local ref) --- platform/android/file_access_jandroid.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index da8ceaff147..ea33e9a67b1 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -182,8 +182,10 @@ bool FileAccessJAndroid::file_exists(const String& p_path) { jstring js = env->NewStringUTF(path.utf8().get_data()); int res = env->CallIntMethod(io,_file_open,js,false); - if (res<=0) + if (res<=0) { + env->DeleteLocalRef(js); return false; + } env->CallVoidMethod(io,_file_close,res); env->DeleteLocalRef(js); return true;