Merge "Fix local reference table overflow error."

This commit is contained in:
Treehugger Robot
2018-11-01 20:00:46 +00:00
committed by Gerrit Code Review

View File

@@ -951,6 +951,7 @@ static jint convertAudioPortFromNative(JNIEnv *env,
jintArray jFormats = NULL; jintArray jFormats = NULL;
jobjectArray jGains = NULL; jobjectArray jGains = NULL;
jobject jHandle = NULL; jobject jHandle = NULL;
jobject jAudioPortConfig = NULL;
jstring jDeviceName = NULL; jstring jDeviceName = NULL;
bool useInMask; bool useInMask;
size_t numPositionMasks = 0; size_t numPositionMasks = 0;
@@ -1129,7 +1130,6 @@ static jint convertAudioPortFromNative(JNIEnv *env,
goto exit; goto exit;
} }
jobject jAudioPortConfig;
jStatus = convertAudioPortConfigFromNative(env, jStatus = convertAudioPortConfigFromNative(env,
*jAudioPort, *jAudioPort,
&jAudioPortConfig, &jAudioPortConfig,
@@ -1165,6 +1165,9 @@ exit:
if (jHandle != NULL) { if (jHandle != NULL) {
env->DeleteLocalRef(jHandle); env->DeleteLocalRef(jHandle);
} }
if (jAudioPortConfig != NULL) {
env->DeleteLocalRef(jAudioPortConfig);
}
return jStatus; return jStatus;
} }
@@ -1235,12 +1238,15 @@ android_media_AudioSystem_listAudioPorts(JNIEnv *env, jobject clazz,
} }
for (size_t i = 0; i < numPorts; i++) { for (size_t i = 0; i < numPorts; i++) {
jobject jAudioPort; jobject jAudioPort = NULL;
jStatus = convertAudioPortFromNative(env, &jAudioPort, &nPorts[i]); jStatus = convertAudioPortFromNative(env, &jAudioPort, &nPorts[i]);
if (jStatus != AUDIO_JAVA_SUCCESS) { if (jStatus != AUDIO_JAVA_SUCCESS) {
goto exit; goto exit;
} }
env->CallBooleanMethod(jPorts, gArrayListMethods.add, jAudioPort); env->CallBooleanMethod(jPorts, gArrayListMethods.add, jAudioPort);
if (jAudioPort != NULL) {
env->DeleteLocalRef(jAudioPort);
}
} }
exit: exit: