diff --git a/tensorflow_lite_support/java/src/native/task/vision/jni_utils.cc b/tensorflow_lite_support/java/src/native/task/vision/jni_utils.cc index af5dad968..4826edce4 100644 --- a/tensorflow_lite_support/java/src/native/task/vision/jni_utils.cc +++ b/tensorflow_lite_support/java/src/native/task/vision/jni_utils.cc @@ -50,6 +50,9 @@ jobject ConvertToCategory(JNIEnv* env, const Class& classification) { jobject jcategory = env->CallStaticObjectMethod(category_class, category_create, label, display_name, classification.score()); + env->DeleteLocalRef(category_class); + env->DeleteLocalRef(label); + env->DeleteLocalRef(display_name); return jcategory; }