diff options
author | Jaehong Jo <jaehong.jo@samsung.com> | 2016-11-30 17:25:53 +0900 |
---|---|---|
committer | Ashok Babu Channa <ashok.channa@samsung.com> | 2016-11-30 13:01:25 +0000 |
commit | 2bf1598fa14d918f3c254feaedd61716cba8d0f1 (patch) | |
tree | 8c7f5f0fd5334266e6eca97a940acc08e2fca48c | |
parent | 64b44c48ab8944c7cae1cabf64aa0e1e98ada932 (diff) | |
download | iotivity-2bf1598fa14d918f3c254feaedd61716cba8d0f1.tar.gz iotivity-2bf1598fa14d918f3c254feaedd61716cba8d0f1.tar.bz2 iotivity-2bf1598fa14d918f3c254feaedd61716cba8d0f1.zip |
Fix static analysis issue in ocresource
- add initial value and null checking
Change-Id: I50731d23865c72d2c03cb3b149b19bf4236bf587
Signed-off-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14955
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
-rwxr-xr-x | resource/csdk/stack/src/ocresource.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index afeecc880..aad78ec08 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -1477,7 +1477,7 @@ OCStackResult OCGetPropertyValue(OCPayloadType type, const char *prop, void **va OCStackResult OCSetAttribute(OCResource* resource, const char* attribute, const void* value) { // See if the attribute already exists in the list. - OCAttribute *resAttrib; + OCAttribute *resAttrib = NULL; for (resAttrib = resource->rsrcAttributes; resAttrib; resAttrib = resAttrib->next) { if (0 == strcmp(attribute, resAttrib->attrName)) @@ -1527,7 +1527,7 @@ exit: OCStackResult OCSetPropertyValue(OCPayloadType type, const char *prop, const void *value) { - if (!prop) + if (!prop || !value) { return OC_STACK_INVALID_PARAM; } @@ -1545,7 +1545,7 @@ OCStackResult OCSetPropertyValue(OCPayloadType type, const char *prop, const voi { OIC_LOG(ERROR, TAG, "Resource does not exist."); } - if (value) + else { res = OCSetAttribute(resource, prop, value); } |