Use the new radio_metadata wrapper for safer memory management.

Bug: b/34054813
Test: VTS, manual - both done in internal branch
Change-Id: I5f4962f86b7732e14c2584a562e9737c92310697
This commit is contained in:
Tomasz Wasilczyk
2017-01-23 14:36:47 -08:00
parent 273b886c49
commit aee690ffad

View File

@@ -23,7 +23,7 @@
#include "JNIHelp.h"
#include "core_jni_helpers.h"
#include <system/radio.h>
#include <system/radio_metadata.h>
#include <system/RadioMetadataWrapper.h>
#include <radio/RadioCallback.h>
#include <radio/Radio.h>
#include <utils/RefBase.h>
@@ -749,7 +749,7 @@ android_hardware_Radio_getProgramInformation(JNIEnv *env, jobject thiz, jobjectA
}
struct radio_program_info nInfo;
radio_metadata_allocate(&nInfo.metadata, 0, 0);
RadioMetadataWrapper metadataWrapper(&nInfo.metadata);
jobject jInfo = NULL;
int jStatus;
@@ -767,7 +767,6 @@ exit:
if (jInfo != NULL) {
env->DeleteLocalRef(jInfo);
}
radio_metadata_deallocate(nInfo.metadata);
return jStatus;
}