fixed the prevent issues for CA linux platform.
authorhyuna0213.jo <hyuna0213.jo@samsung.com>
Fri, 18 Sep 2015 07:23:29 +0000 (16:23 +0900)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Tue, 22 Sep 2015 16:24:12 +0000 (16:24 +0000)
-remove the build warning
-memory free logic
-changed the structure initialization

Change-Id: Iab788102c0ea259fac54ae43c01fcb504ba8eec3
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2679
Reviewed-by: Naga Ashok Jampani <jn.ashok@samsung.com>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/connectivity/src/tcp_adapter/catcpserver.c

index 102893a..37657fb 100644 (file)
@@ -639,9 +639,10 @@ static size_t CACheckPayloadLength(const void *data, size_t dlen)
     if (pdu->data)
     {
         payloadLen = (unsigned char *) pdu->hdr + pdu->length - pdu->data;
-        OICFree(pdu);
     }
 
+    OICFree(pdu);
+
     return payloadLen;
 }
 
@@ -685,10 +686,10 @@ static void sendData(const CAEndpoint_t *endpoint,
     }
 
     // #4. send data to TCP Server
-    size_t remainLen = dlen;
+    ssize_t remainLen = dlen;
     do
     {
-        size_t len = send(svritem->u4tcp.fd, data, remainLen, 0);
+        ssize_t len = send(svritem->u4tcp.fd, data, remainLen, 0);
         if (-1 == len)
         {
             if (EWOULDBLOCK != errno)