core: jni: fix memory leak in SoundTrigger JNI
jExtras object created in android_hardware_SoundTrigger
JNISoundTriggerCallback::onRecognitionEvent()
is not deleted causing a memory which depletes JNI
JNI local storage during back-to-back SoundTrigger
detections.
Delete jExtra after storing in return object.
Change-Id: Ib7048917b7538a27d4519504b30252879acc5447
CRs-fixed: 733969
diff --git a/core/jni/android_hardware_SoundTrigger.cpp b/core/jni/android_hardware_SoundTrigger.cpp
index 7b33bc2..d6b44c6 100644
--- a/core/jni/android_hardware_SoundTrigger.cpp
+++ b/core/jni/android_hardware_SoundTrigger.cpp
@@ -267,6 +267,7 @@
jAudioFormat, jData, jExtras);
env->DeleteLocalRef(jAudioFormat);
env->DeleteLocalRef(jData);
+ env->DeleteLocalRef(jExtras);
} else {
jEvent = env->NewObject(gRecognitionEventClass, gRecognitionEventCstor,
event->status, event->model, event->capture_available,