From 978cb0e884dea9be4d98a0b52ae930655f7d9ad8 Mon Sep 17 00:00:00 2001 From: sanikoyes Date: Mon, 11 Jul 2016 12:41:54 +0800 Subject: 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(-) (limited to 'platform/android/file_access_jandroid.cpp') diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index da8ceaff1..ea33e9a67 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; -- cgit v1.2.3-70-g09d2