Merge "Fix missing Release for GetStringUTFChars calls." into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6ccdee38b5
@@ -459,8 +459,12 @@ static jobject NativeGetOverlayableInfo(JNIEnv* env, jclass /*clazz*/, jlong ptr
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto overlayable_name_native = std::string(env->GetStringUTFChars(overlayable_name, NULL));
|
const char* overlayable_name_native = env->GetStringUTFChars(overlayable_name, nullptr);
|
||||||
|
if (overlayable_name_native == nullptr) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
auto actor = overlayable_map.find(overlayable_name_native);
|
auto actor = overlayable_map.find(overlayable_name_native);
|
||||||
|
env->ReleaseStringUTFChars(overlayable_name, overlayable_name_native);
|
||||||
if (actor == overlayable_map.end()) {
|
if (actor == overlayable_map.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <nativehelper/JNIHelp.h>
|
#include <nativehelper/JNIHelp.h>
|
||||||
|
#include <nativehelper/ScopedUtfChars.h>
|
||||||
|
|
||||||
using namespace android;
|
using namespace android;
|
||||||
using namespace img_utils;
|
using namespace img_utils;
|
||||||
@@ -1264,16 +1265,14 @@ static void DngCreator_init(JNIEnv* env, jobject thiz, jobject characteristicsPt
|
|||||||
|
|
||||||
sp<NativeContext> nativeContext = new NativeContext(characteristics, results);
|
sp<NativeContext> nativeContext = new NativeContext(characteristics, results);
|
||||||
|
|
||||||
const char* captureTime = env->GetStringUTFChars(formattedCaptureTime, nullptr);
|
ScopedUtfChars captureTime(env, formattedCaptureTime);
|
||||||
|
if (captureTime.size() + 1 != NativeContext::DATETIME_COUNT) {
|
||||||
size_t len = strlen(captureTime) + 1;
|
|
||||||
if (len != NativeContext::DATETIME_COUNT) {
|
|
||||||
jniThrowException(env, "java/lang/IllegalArgumentException",
|
jniThrowException(env, "java/lang/IllegalArgumentException",
|
||||||
"Formatted capture time string length is not required 20 characters");
|
"Formatted capture time string length is not required 20 characters");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeContext->setCaptureTime(String8(captureTime));
|
nativeContext->setCaptureTime(String8(captureTime.c_str()));
|
||||||
|
|
||||||
DngCreator_setNativeContext(env, thiz, nativeContext);
|
DngCreator_setNativeContext(env, thiz, nativeContext);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user