From: Ravi Nanjundappa Date: Tue, 22 Sep 2015 04:48:32 +0000 (+0530) Subject: android_api: Fix cppcheck issues in android/android_api/base/jni/ dir X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ff4d5ce60cb672f614a16c9e26b32ebf3d396be;p=contrib%2Fiotivity.git android_api: Fix cppcheck issues in android/android_api/base/jni/ dir This patch fixes the "(error) Possible null pointer dereference:" issues reported by cppcheck tool in android/android_api/base/jni/ directory. Change-Id: I92a629df583cec5ec083c1427bd6cdc08ca9dc6b Signed-off-by: Ravi Nanjundappa Reviewed-on: https://gerrit.iotivity.org/gerrit/2909 Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- diff --git a/android/android_api/base/jni/JniOcSecureResource.cpp b/android/android_api/base/jni/JniOcSecureResource.cpp index d2929de..d36cb1b 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;