diff options
author | Gubbala Venugopal Rao <c_vgubba@qti.qualcomm.com> | 2014-03-26 13:44:58 +0530 |
---|---|---|
committer | Scott Mertz <scott@cyngn.com> | 2014-09-23 14:25:26 -0700 |
commit | 1c1919892885d0b7eb73d382f3d1370b47ff820e (patch) | |
tree | faf32484a6268fd149d93262eaaff872b9cb2cfa | |
parent | a64b0d5a044d596bed96be8f89afa36cfa9e7445 (diff) | |
download | android_packages_apps_Bluetooth-1c1919892885d0b7eb73d382f3d1370b47ff820e.tar.gz android_packages_apps_Bluetooth-1c1919892885d0b7eb73d382f3d1370b47ff820e.tar.bz2 android_packages_apps_Bluetooth-1c1919892885d0b7eb73d382f3d1370b47ff820e.zip |
Bluetooth: Delete the pointer to avoid memory leakage
Delete the pAttrs pointer incase of invalid input
parameters
Change-Id: I0da9a804da3462dcd582a9c6d761310282b2db83
CRs-Fixed: 638300
-rw-r--r-- | jni/com_android_bluetooth_avrcp.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jni/com_android_bluetooth_avrcp.cpp b/jni/com_android_bluetooth_avrcp.cpp index 8aa4e7f8a..c59252be8 100644 --- a/jni/com_android_bluetooth_avrcp.cpp +++ b/jni/com_android_bluetooth_avrcp.cpp @@ -483,6 +483,7 @@ static jboolean getPlayerAppValueRspNative(JNIEnv *env ,jobject object , jbyte n } attr = env->GetByteArrayElements(value, NULL); if (!attr) { + delete[] pAttrs; jniThrowIOException(env, EINVAL); return JNI_FALSE; } @@ -570,6 +571,10 @@ static jboolean sendSettingsTextRspNative(JNIEnv *env, jobject object, jint num_ return JNI_FALSE; } pAttrs = new btrc_player_setting_text_t[num_attr]; + if (!pAttrs) { + ALOGE("sendSettingsTextRspNative: not have enough memeory"); + return JNI_FALSE; + } arr = env->GetByteArrayElements(attr, NULL); if (!arr) { delete[] pAttrs; @@ -623,6 +628,10 @@ static jboolean sendValueTextRspNative(JNIEnv *env, jobject object, jint num_att return JNI_FALSE; } pAttrs = new btrc_player_setting_text_t[num_attr]; + if (!pAttrs) { + ALOGE("sendValueTextRspNative: not have enough memeory"); + return JNI_FALSE; + } arr = env->GetByteArrayElements(attr, NULL); if (!arr) { delete[] pAttrs; |