Adding fix for Sonarqube major issues for IoTivity 1.2-rel 70/211870/2
authorsamanway <samanway@samanway.sa.corp.samsungelectronics.net>
Tue, 23 Jul 2019 12:05:15 +0000 (17:35 +0530)
committerSudipto Bal <sudipto.bal@samsung.com>
Fri, 9 Aug 2019 12:54:57 +0000 (12:54 +0000)
     - Fixed Invalid number of character ')'s in caleadapter.c
     - Fixed Possible null pointer dereference in ccmessagehandler.c
     - Fixed double memory free condition JniNotificationConsumer.cpp
     - Fixed double memory free condition JniNotificationProvider.cpp

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/548/commits/222bbb7e84830c5a2ecc17332df1c60f2bcf3a71
(cherry-picked from 222bbb7e84830c5a2ecc17332df1c60f2bcf3a71)

Change-Id: I724ee387dfc932c0614b7e19bb289b85d0254106
Signed-off by: samanway <samanway@samanway.sa.corp.samsungelectronics.net>
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c
resource/csdk/connectivity/src/camessagehandler.c
service/notification/android/notification-service/src/main/jni/consumer/JniNotificationConsumer.cpp
service/notification/android/notification-service/src/main/jni/provider/JniNotificationProvider.cpp

index d9ac819..10fdffd 100644 (file)
@@ -2006,7 +2006,7 @@ static void CALEDataReceiverHandlerSingleThread(const uint8_t *data,
 static CAResult_t CALEServerSendDataSingleThread(const uint8_t *data,
                                                  uint32_t dataLen)
 {
-    OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "%s", __func__););
+    OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "%s", __func__);
 
     VERIFY_NON_NULL(data, CALEADAPTER_TAG, "Param data is NULL");
 
index 41b8884..c4b25dd 100644 (file)
@@ -1642,6 +1642,11 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu)
        char log_buffer[1024] = "";
        sprintf(log_buffer, "CA_LOG [%5d] | %-13s | %-12s | msg size : %4d | %s", pdu->transport_hdr->udp.id , type, method, pdu->length, info->resourceUri);
 
+       if(NULL != info)
+       {
+               sprintf(log_buffer, "CA_LOG [%5d] | %-13s | %-12s | msg size : %4d | %s", pdu->transport_hdr->udp.id , type, method, pdu->length, info->resourceUri);
+       }
+
        puts(log_buffer);
 }
 
index 7abe708..4c592e0 100755 (executable)
@@ -602,6 +602,7 @@ jobject getJavaMessage(JNIEnv *env, OIC::Service::NSMessage message)
     {\r
         NS_LOGE ("Failed to create OcRepresentation");\r
         delete ocRepresentation;\r
+        return NULL;\r
     }\r
     else\r
     {\r
index 2c4ee96..4658fb7 100755 (executable)
@@ -548,6 +548,7 @@ jobject getJavaMessage(JNIEnv *env, OIC::Service::NSMessage message)
     {
         NS_LOGE ("Failed to create OcRepresentation");
         delete ocRepresentation;
+        return NULL;
     }
     else
     {