diff options
author | Mike Lockwood <lockwood@google.com> | 2014-06-02 18:32:20 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-02 18:32:20 +0000 |
commit | 307a37c2afc30190151285eb96ebd6a6940a96ec (patch) | |
tree | c43ec6fb0e1abbc5331eb8916307a798611c7aba /media/jni/android_mtp_MtpDatabase.cpp | |
parent | 776512d4b6a7c1b1b7893cde5bec1f3d65c0ea94 (diff) | |
parent | 1ac54ec69bfcda2638b05c7daa4300ec5749e7b8 (diff) | |
download | frameworks_base-307a37c2afc30190151285eb96ebd6a6940a96ec.zip frameworks_base-307a37c2afc30190151285eb96ebd6a6940a96ec.tar.gz frameworks_base-307a37c2afc30190151285eb96ebd6a6940a96ec.tar.bz2 |
am 1ac54ec6: am 750e78bb: am 27eb205e: Merge "MtpDatabase JNI: Fixed a memory-leak in getObjectPropertyValue()."
* commit '1ac54ec69bfcda2638b05c7daa4300ec5749e7b8':
MtpDatabase JNI: Fixed a memory-leak in getObjectPropertyValue().
Diffstat (limited to 'media/jni/android_mtp_MtpDatabase.cpp')
-rw-r--r-- | media/jni/android_mtp_MtpDatabase.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp index d781336..15974e5 100644 --- a/media/jni/android_mtp_MtpDatabase.cpp +++ b/media/jni/android_mtp_MtpDatabase.cpp @@ -433,16 +433,14 @@ MtpResponseCode MyMtpDatabase::getObjectPropertyValue(MtpObjectHandle handle, case MTP_TYPE_STR: { jstring stringValue = (jstring)env->GetObjectArrayElement(stringValuesArray, 0); + const char* str = (stringValue ? env->GetStringUTFChars(stringValue, NULL) : NULL); if (stringValue) { - const char* str = env->GetStringUTFChars(stringValue, NULL); - if (str == NULL) { - return MTP_RESPONSE_GENERAL_ERROR; - } packet.putString(str); env->ReleaseStringUTFChars(stringValue, str); } else { packet.putEmptyString(); } + env->DeleteLocalRef(stringValue); break; } default: |