From 3216d3d1525191c86a32e46f9f3f21836fca67ad Mon Sep 17 00:00:00 2001 From: "jaesick.shin" Date: Thu, 13 Oct 2016 10:39:56 +0900 Subject: [PATCH] Add logic about checking the NULL and modify warning code. This patch include, check the NULL and modify warning code. Change-Id: Ie28548563357e0c9565ecdcd776cce60d3d42f33 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/13193 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- .../cpp-wrapper/examples/linux/notificationserviceconsumer.cpp | 2 +- .../cpp-wrapper/examples/linux/notificationserviceprovider.cpp | 2 +- service/notification/src/provider/NSProviderSubscription.c | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/service/notification/cpp-wrapper/examples/linux/notificationserviceconsumer.cpp b/service/notification/cpp-wrapper/examples/linux/notificationserviceconsumer.cpp index e005bcf..1efff70 100755 --- a/service/notification/cpp-wrapper/examples/linux/notificationserviceconsumer.cpp +++ b/service/notification/cpp-wrapper/examples/linux/notificationserviceconsumer.cpp @@ -131,7 +131,7 @@ void *OCProcessThread(void *ptr) int main(void) { - pthread_t OCThread = NULL; + pthread_t OCThread = 0; std::cout << "start Iotivity" << std::endl; diff --git a/service/notification/cpp-wrapper/examples/linux/notificationserviceprovider.cpp b/service/notification/cpp-wrapper/examples/linux/notificationserviceprovider.cpp index 8b2cd56..374405e 100755 --- a/service/notification/cpp-wrapper/examples/linux/notificationserviceprovider.cpp +++ b/service/notification/cpp-wrapper/examples/linux/notificationserviceprovider.cpp @@ -82,7 +82,7 @@ void syncCallback(OIC::Service::NSSyncInfo *sync) int main() { int num = 0; - pthread_t processThread = NULL; + pthread_t processThread = 0; std::cout << "start Iotivity" << std::endl; diff --git a/service/notification/src/provider/NSProviderSubscription.c b/service/notification/src/provider/NSProviderSubscription.c index 1c0d70b..f526a46 100644 --- a/service/notification/src/provider/NSProviderSubscription.c +++ b/service/notification/src/provider/NSProviderSubscription.c @@ -135,7 +135,9 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour { NS_LOG(DEBUG, "resourceType == NS_RESOURCE_MESSAGE"); NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); + NS_VERIFY_NOT_NULL_V(element); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); + NS_VERIFY_NOT_NULL_V(subData); OICStrcpy(subData->id, UUID_STRING_SIZE, id); NS_LOG_V(DEBUG, "SubList ID = [%s]", subData->id); @@ -192,7 +194,9 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour { NS_LOG(DEBUG, "resourceType == NS_RESOURCE_SYNC"); NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); + NS_VERIFY_NOT_NULL_V(element); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); + NS_VERIFY_NOT_NULL_V(subData); OICStrcpy(subData->id, UUID_STRING_SIZE, id); NS_LOG_V(DEBUG, "SubList ID = [%s]", subData->id); -- 2.7.4