Fix for crash in Tizen casample when message type is CA_MSG_RESET
authorvimala.v <vimala.v@samsung.com>
Mon, 28 Mar 2016 10:36:21 +0000 (16:06 +0530)
committerAshok Babu Channa <ashok.channa@samsung.com>
Mon, 28 Mar 2016 12:46:46 +0000 (12:46 +0000)
Change-Id: I94937968bb6e63c74d0458919cdfedce1b2b60b0
Signed-off-by: vimala.v <vimala.v@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7397
Reviewed-by: Abhishek Sharma <ce.abhishek@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/connectivity/samples/tizen/casample.c

index 7e0810f..2d2a594 100644 (file)
@@ -1169,7 +1169,13 @@ void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info)
     responseData.messageId = (info != NULL) ? info->messageId : 0;
     responseData.resourceUri = (info != NULL) ? info->resourceUri : 0;
 
-    if(CA_MSG_RESET != messageType)
+    if (CA_MSG_RESET == messageType ||
+        (CA_MSG_ACKNOWLEDGE == messageType && CA_EMPTY == responseCode))
+    {
+        printf("RESET or ACK/EMPTY. there will be not payload/option\n");
+
+    }
+    else
     {
         responseData.token = (info != NULL) ? info->token : NULL;
         responseData.tokenLength = (info != NULL) ? info->tokenLength : 0;
@@ -1217,8 +1223,8 @@ void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info)
                          (const char *) responseData.resourceUri);
             }
         }
+        responseData.payloadSize = strlen((char *)responseData.payload)+1;
     }
-    responseData.payloadSize = strlen((char *)responseData.payload)+1;
     CAResponseInfo_t responseInfo = { 0 };
     responseInfo.result = responseCode;
     responseInfo.info = responseData;