diff options
author | George Burgess <gbiv@google.com> | 2021-07-22 17:26:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-07-22 17:26:32 +0000 |
commit | a66b67936f8ce65a1c7bdcd73ba95885e88a6ebe (patch) | |
tree | 0ecf96cfd8b2a0811601e3790670bcc33e133a40 | |
parent | a9949c86c6383ba8db250a1ff64e87cd2effcaae (diff) | |
parent | e485264ff59612cc3235affa623b09a532891c7b (diff) |
Merge "MTP: fix a memory leak" into sc-dev
-rw-r--r-- | media/jni/android_mtp_MtpDevice.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/media/jni/android_mtp_MtpDevice.cpp b/media/jni/android_mtp_MtpDevice.cpp index ac89fecd9150..8436ba412b2d 100644 --- a/media/jni/android_mtp_MtpDevice.cpp +++ b/media/jni/android_mtp_MtpDevice.cpp @@ -416,20 +416,14 @@ android_mtp_MtpDevice_set_device_property_init_version(JNIEnv *env, jobject thiz return -1; } - MtpProperty* property = new MtpProperty(MTP_DEVICE_PROPERTY_SESSION_INITIATOR_VERSION_INFO, - MTP_TYPE_STR, true); - if (!property) { - env->ThrowNew(clazz_io_exception, "Failed to obtain property."); - return -1; - } - - if (property->getDataType() != MTP_TYPE_STR) { + MtpProperty property(MTP_DEVICE_PROPERTY_SESSION_INITIATOR_VERSION_INFO, MTP_TYPE_STR, true); + if (property.getDataType() != MTP_TYPE_STR) { env->ThrowNew(clazz_io_exception, "Unexpected property data type."); return -1; } - property->setCurrentValue(propertyStr); - if (!device->setDevicePropValueStr(property)) { + property.setCurrentValue(propertyStr); + if (!device->setDevicePropValueStr(&property)) { env->ThrowNew(clazz_io_exception, "Failed to obtain property value."); return -1; } |