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

Commit f37d2a45 authored by Henry Fang's avatar Henry Fang Committed by Automerger Merge Worker
Browse files

Merge "fix memory leak in initilization and finalization" into sc-dev am: d2b28040 am: 187e962d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15238059

Change-Id: Ie47b84118cec02a7118c14c272a06510cb1b596d
parents ecfcbc34 187e962d
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -339,6 +339,12 @@ MediaEvent::~MediaEvent() {
    if (pC2Buffer != NULL) {
        pC2Buffer->unregisterOnDestroyNotify(&DestroyCallback, this);
    }

    if (mLinearBlockObj != NULL) {
        env->DeleteWeakGlobalRef(mLinearBlockObj);
        mLinearBlockObj = NULL;
    }

    mFilterClient = NULL;
}

@@ -2450,7 +2456,10 @@ static sp<JTuner> setTuner(JNIEnv *env, jobject thiz, const sp<JTuner> &tuner) {
    if (old != NULL) {
        old->decStrong(thiz);
    }

    if (tuner != NULL) {
        env->SetLongField(thiz, gFields.tunerContext, (jlong)tuner.get());
    }

    return old;
}
@@ -4042,6 +4051,7 @@ static jint android_media_tv_Tuner_open_demux(JNIEnv* env, jobject thiz, jint ha

static jint android_media_tv_Tuner_close_tuner(JNIEnv* env, jobject thiz) {
    sp<JTuner> tuner = getTuner(env, thiz);
    setTuner(env, thiz, NULL);
    return (jint) tuner->close();
}