This patch fixes the the below issue reported by cppcheck tool in security dir:
"(error) Possible null pointer dereference: jsonObj - otherwise it is
redundant to check if jsonObj is null at line 259
(error) Possible null pointer dereference: jsonStr1 - otherwise it is
redundant to check if jsonStr1 is null at line 132"
Null value check of jsonObj and jsonStr1 are removed as it in unnecessary here.
Change-Id: I6c0676a58780afea3026c3e1332c8ecac7c0dd1e
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1508
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
if(jsonObj)
{
VERIFY_SUCCESS(TAG, cJSON_String == jsonObj->type, ERROR);
- if(jsonObj && cJSON_String == jsonObj->type)
+ if(cJSON_String == jsonObj->type)
{
//Check for empty string, in case DeviceId field has not been set yet
if (jsonObj->valuestring[0])
char * jsonStr2 = BinToAclJSON(acl);
EXPECT_TRUE(NULL != jsonStr2);
- if (jsonStr1 && jsonStr2)
- {
- EXPECT_STREQ(jsonStr1, jsonStr2);
- }
+ EXPECT_STREQ(jsonStr1, jsonStr2);
OICFree(jsonStr1);
OICFree(jsonStr2);