Fixed issues reported by Prevent static analysis tool
authorSandipan Patra <sandipan.p@samsung.com>
Tue, 13 Oct 2015 12:56:07 +0000 (18:26 +0530)
committerJon A. Cruz <jonc@osg.samsung.com>
Wed, 9 Dec 2015 20:37:38 +0000 (20:37 +0000)
Fix issues in CA and Routing manager reported by Prevent tool

Change-Id: I855181fa12e8e8b483f48c071fa6e12de9b94c2c
Signed-off-by: Sandipan Patra <sandipan.p@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3857
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Abhishek Pandey <abhi.siso@samsung.com>
Reviewed-by: Abhishek Sharma <ce.abhishek@samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
(cherry picked from commit adb97afe0f0b1c8b4fcd2b44495531ccd5ee4dd6)
Reviewed-on: https://gerrit.iotivity.org/gerrit/4459

resource/csdk/connectivity/common/src/ulinklist.c
resource/csdk/routing/src/routingtablemanager.c

index e75c49f..e796f4b 100644 (file)
@@ -124,6 +124,8 @@ CAResult_t u_linklist_free(u_linklist_t **linklist)
 
         (*linklist)->size -= 1;
     }
+
+    OICFree(*linklist);
     *linklist=NULL;
 
     return CA_STATUS_OK;
index d9d76f7..b611490 100644 (file)
@@ -609,7 +609,7 @@ bool RTMIsObserverPresent(CAEndpoint_t devAddr, OCObservationId *obsID,
     while (NULL != iterTable)
     {
         RTMGatewayEntry_t *entry = u_linklist_get_data(iterTable);
-        if (NULL == entry && NULL == entry->destination)
+        if (NULL == entry || NULL == entry->destination)
         {
             OC_LOG(ERROR, TAG, "entry is NULL");
             return false;