diff --git a/framework/android/connector/driver/js/src/main/cpp/src/convert_utils.cc b/framework/android/connector/driver/js/src/main/cpp/src/convert_utils.cc index 84f1af7a167..46615e04cf6 100644 --- a/framework/android/connector/driver/js/src/main/cpp/src/convert_utils.cc +++ b/framework/android/connector/driver/js/src/main/cpp/src/convert_utils.cc @@ -344,6 +344,7 @@ std::tuple ConvertUtils::ToHippyMap(const std::share auto to_jobject_tuple = ToJObject(ctx, item); if (!std::get<0>(to_jobject_tuple)) { + j_env->DeleteLocalRef(key_j_obj); return std::make_tuple(false, std::get<1>(to_jobject_tuple), static_cast(nullptr)); } jobject value_j_obj = std::get<2>(to_jobject_tuple); @@ -644,6 +645,7 @@ std::tupleCreateNull(); } else { + j_env->DeleteLocalRef(obj); return std::make_tuple(false, "UnSupported Type in HippyArray or HippyMap", static_cast>(nullptr)); }