Merge "AudioRecord JNI: fix mem leak on audio_attributes_t" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2e73ff5e6f
@@ -368,10 +368,19 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
|
||||
// of the Java object (in mNativeCallbackCookie) so we can free the memory in finalize()
|
||||
env->SetLongField(thiz, javaAudioRecordFields.nativeCallbackCookie, (jlong)lpCallbackData);
|
||||
|
||||
if (paa != NULL) {
|
||||
// audio attributes were copied in AudioRecord creation
|
||||
free(paa);
|
||||
paa = NULL;
|
||||
}
|
||||
|
||||
return (jint) AUDIO_JAVA_SUCCESS;
|
||||
|
||||
// failure:
|
||||
native_init_failure:
|
||||
if (paa != NULL) {
|
||||
free(paa);
|
||||
}
|
||||
env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
|
||||
env->DeleteGlobalRef(lpCallbackData->audioRecord_ref);
|
||||
delete lpCallbackData;
|
||||
|
||||
Reference in New Issue
Block a user