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

Commit fe87781f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix local reference table overflow error."

parents 8c64274e 82840c4e
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -951,6 +951,7 @@ static jint convertAudioPortFromNative(JNIEnv *env,
    jintArray jFormats = NULL;
    jobjectArray jGains = NULL;
    jobject jHandle = NULL;
    jobject jAudioPortConfig = NULL;
    jstring jDeviceName = NULL;
    bool useInMask;
    size_t numPositionMasks = 0;
@@ -1129,7 +1130,6 @@ static jint convertAudioPortFromNative(JNIEnv *env,
        goto exit;
    }

    jobject jAudioPortConfig;
    jStatus = convertAudioPortConfigFromNative(env,
                                                       *jAudioPort,
                                                       &jAudioPortConfig,
@@ -1165,6 +1165,9 @@ exit:
    if (jHandle != NULL) {
        env->DeleteLocalRef(jHandle);
    }
    if (jAudioPortConfig != NULL) {
        env->DeleteLocalRef(jAudioPortConfig);
    }

    return jStatus;
}
@@ -1235,12 +1238,15 @@ android_media_AudioSystem_listAudioPorts(JNIEnv *env, jobject clazz,
    }

    for (size_t i = 0; i < numPorts; i++) {
        jobject jAudioPort;
        jobject jAudioPort = NULL;
        jStatus = convertAudioPortFromNative(env, &jAudioPort, &nPorts[i]);
        if (jStatus != AUDIO_JAVA_SUCCESS) {
            goto exit;
        }
        env->CallBooleanMethod(jPorts, gArrayListMethods.add, jAudioPort);
        if (jAudioPort != NULL) {
            env->DeleteLocalRef(jAudioPort);
        }
    }

exit: