add null checker related some parmaters in CA layer
authorjihwan.seo <jihwan.seo@samsung.com>
Mon, 12 Dec 2016 10:43:35 +0000 (19:43 +0900)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Wed, 14 Dec 2016 15:53:59 +0000 (15:53 +0000)
Change-Id: Idd29912d0dff5022809f72586ebef913a84b55bc
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15493
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/csdk/connectivity/src/cainterfacecontroller.c

index 42ad155..8d3c6cd 100644 (file)
@@ -391,10 +391,8 @@ void CAStopAdapter(CATransportAdapter_t transportType)
 
 CAResult_t CAGetNetworkInfo(CAEndpoint_t **info, uint32_t *size)
 {
-    if (info == NULL || size == NULL)
-    {
-        return CA_STATUS_INVALID_PARAM;
-    }
+    VERIFY_NON_NULL(info, TAG, "info is null");
+    VERIFY_NON_NULL(size, TAG, "size is null");
 
     CAEndpoint_t **tempInfo = (CAEndpoint_t**) OICCalloc(g_numberOfAdapters, sizeof(*tempInfo));
     if (!tempInfo)
@@ -501,12 +499,7 @@ memory_error_exit:
 CAResult_t CASendUnicastData(const CAEndpoint_t *endpoint, const void *data, uint32_t length,
                              CADataType_t dataType)
 {
-    if (endpoint == NULL)
-    {
-        OIC_LOG(DEBUG, TAG, "Invalid endpoint");
-        return CA_STATUS_INVALID_PARAM;
-    }
-
+    VERIFY_NON_NULL(endpoint, TAG, "endpoint is null");
 
     u_arraylist_t *list = CAGetSelectedNetworkList();
     if (!list)
@@ -564,6 +557,8 @@ CAResult_t CASendUnicastData(const CAEndpoint_t *endpoint, const void *data, uin
 CAResult_t CASendMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t length,
                                CADataType_t dataType)
 {
+    VERIFY_NON_NULL(endpoint, TAG, "endpoint is null");
+
     u_arraylist_t *list = CAGetSelectedNetworkList();
     if (!list)
     {
@@ -754,6 +749,8 @@ CAResult_t CAStartDiscoveryServerAdapters()
 
 bool CAIsLocalEndpoint(const CAEndpoint_t *ep)
 {
+    VERIFY_NON_NULL_RET(ep, TAG, "ep is null", false);
+
 #ifdef IP_ADAPTER
     if (ep->adapter & CA_ADAPTER_IP)
     {