X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=android%2Fandroid_api%2Fbase%2Fjni%2FJniOcSecureResource.cpp;h=77c8dc6df78d4a0364766ec6a23442e67c9059b7;hb=390866079e285d2c74918432c0d597d5da52f8a0;hp=f06b9bb7c58ec1f7411b4518f9a6e6dcae9d942c;hpb=3e9402ad71cb3e93266a77796f44d17bab9853fd;p=platform%2Fupstream%2Fiotivity.git diff --git a/android/android_api/base/jni/JniOcSecureResource.cpp b/android/android_api/base/jni/JniOcSecureResource.cpp index f06b9bb..77c8dc6 100644 --- a/android/android_api/base/jni/JniOcSecureResource.cpp +++ b/android/android_api/base/jni/JniOcSecureResource.cpp @@ -211,12 +211,14 @@ OCStackResult JniOcSecureResource::provisionACL(JNIEnv* env, jobject _acl, jobje OCStackResult ret; JniProvisionResultListner *resultListener = AddProvisionResultListener(env, jListener); OicSecAcl_t *acl = new OicSecAcl_t; - acl->next = nullptr; + if (!acl) { return OC_STACK_NO_MEMORY; } + acl->next = nullptr; + if (OC_STACK_OK != JniSecureUtils::convertJavaACLToOCAcl(env, _acl, acl)) { delete acl; @@ -354,6 +356,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_removeDevice (JNIEnv *env, jobject thiz, jint timeout, jobject jListener) { LOGD("OcSecureResource_removeDevice"); + if (timeout < 0) + { + ThrowOcException(OC_STACK_INVALID_PARAM, "Timeout value cannot be negative"); + return; + } + if (!jListener) { ThrowOcException(OC_STACK_INVALID_PARAM, "provisionResultListener cannot be null"); @@ -564,6 +572,7 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcSecureResource_getLinkedDevic { LOGE("%s", e.reason().c_str()); ThrowOcException(e.code(), e.reason().c_str()); + return nullptr; } }