Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f23b609 authored by Bharath Ramachandramurthy's avatar Bharath Ramachandramurthy Committed by Linux Build Service Account
Browse files

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
parent 68936fad
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -267,6 +267,7 @@ void JNISoundTriggerCallback::onRecognitionEvent(struct sound_trigger_recognitio
                                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,