Add logic about checking the NULL and modify warning code.
authorjaesick.shin <jaesick.shin@samsung.com>
Thu, 13 Oct 2016 01:39:56 +0000 (10:39 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 13 Oct 2016 04:22:50 +0000 (04:22 +0000)
This patch include, check the NULL and modify warning code.

Change-Id: Ie28548563357e0c9565ecdcd776cce60d3d42f33
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13195
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/notification/cpp-wrapper/examples/linux/notificationserviceconsumer.cpp
service/notification/cpp-wrapper/examples/linux/notificationserviceprovider.cpp
service/notification/src/provider/NSProviderSubscription.c

index e005bcf..1efff70 100755 (executable)
@@ -131,7 +131,7 @@ void *OCProcessThread(void *ptr)
 \r
 int main(void)\r
 {\r
-    pthread_t OCThread = NULL;\r
+    pthread_t OCThread = 0;\r
 \r
     std::cout << "start Iotivity" << std::endl;\r
 \r
index 8b2cd56..374405e 100755 (executable)
@@ -82,7 +82,7 @@ void syncCallback(OIC::Service::NSSyncInfo *sync)
 int main()\r
 {\r
     int num = 0;\r
-    pthread_t processThread = NULL;\r
+    pthread_t processThread = 0;\r
 \r
     std::cout << "start Iotivity" << std::endl;\r
 \r
index 1c0d70b..f526a46 100644 (file)
@@ -135,7 +135,9 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
     {\r
         NS_LOG(DEBUG, "resourceType == NS_RESOURCE_MESSAGE");\r
         NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
+        NS_VERIFY_NOT_NULL_V(element);\r
         NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
+        NS_VERIFY_NOT_NULL_V(subData);\r
 \r
         OICStrcpy(subData->id, UUID_STRING_SIZE, id);\r
         NS_LOG_V(DEBUG, "SubList ID = [%s]", subData->id);\r
@@ -192,7 +194,9 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
     {\r
         NS_LOG(DEBUG, "resourceType == NS_RESOURCE_SYNC");\r
         NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
+        NS_VERIFY_NOT_NULL_V(element);\r
         NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData));\r
+        NS_VERIFY_NOT_NULL_V(subData);\r
 \r
         OICStrcpy(subData->id, UUID_STRING_SIZE, id);\r
         NS_LOG_V(DEBUG, "SubList ID = [%s]", subData->id);\r