From: jaesick.shin Date: Fri, 14 Oct 2016 06:07:54 +0000 (+0900) Subject: Bug fix about result of static anlayzer. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01ef2e59a5a72222d0106d92529076daa2d05f7c;p=contrib%2Fiotivity.git Bug fix about result of static anlayzer. this patch include, bug fix about memory leak and coding idiom. Change-Id: I6fba4a8b182ce88cda44571ebb490c7573812c01 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/13267 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/notification/cpp-wrapper/unittest/NSProviderServiceTest.cpp b/service/notification/cpp-wrapper/unittest/NSProviderServiceTest.cpp index e1b9f02..be8e416 100755 --- a/service/notification/cpp-wrapper/unittest/NSProviderServiceTest.cpp +++ b/service/notification/cpp-wrapper/unittest/NSProviderServiceTest.cpp @@ -236,6 +236,8 @@ TEST_F(NotificationProviderServiceTest, NeverCallNotifyOnConsumerByAcceptIsFalse std::unique_lock< std::mutex > lock { mutexForCondition }; responseCon.wait_for(lock, g_waitForResponse); + delete msg; + EXPECT_EQ(expectTrue, true); } @@ -264,6 +266,8 @@ TEST_F(NotificationProviderServiceTest, ExpectCallNotifyOnConsumerByAcceptIsTrue OIC::Service::NSProviderService::getInstance()->sendMessage(msg); std::unique_lock< std::mutex > lock { mutexForCondition }; responseCon.wait_for(lock, g_waitForResponse); + + delete msg; } TEST_F(NotificationProviderServiceTest, ExpectCallbackSyncOnReadToConsumer) @@ -292,6 +296,8 @@ TEST_F(NotificationProviderServiceTest, ExpectCallbackSyncOnReadToConsumer) OIC::Service::NSSyncInfo::NSSyncType::NS_SYNC_READ); std::unique_lock< std::mutex > lock { mutexForCondition }; responseCon.wait_for(lock, g_waitForResponse); + + delete msg; } TEST_F(NotificationProviderServiceTest, ExpectCallbackSyncOnReadFromConsumer) @@ -318,6 +324,8 @@ TEST_F(NotificationProviderServiceTest, ExpectCallbackSyncOnReadFromConsumer) g_consumerSimul.syncToProvider(type, id, msg->getProviderId()); std::unique_lock< std::mutex > lock { mutexForCondition }; responseCon.wait(lock); + + delete msg; } TEST_F(NotificationProviderServiceTest, ExpectEqualAddedTopicsAndRegisteredTopics) diff --git a/service/notification/unittest/NSConsumerSimulator.h b/service/notification/unittest/NSConsumerSimulator.h index bd0a6e3..f3183a9 100644 --- a/service/notification/unittest/NSConsumerSimulator.h +++ b/service/notification/unittest/NSConsumerSimulator.h @@ -194,7 +194,8 @@ private: std::vector postTopicArr; for(std::vector::iterator it = topicArr.begin(); - it != topicArr.end(); ++it) { + it != topicArr.end(); ++it) + { /* std::cout << *it; ... */ OC::OCRepresentation topic = *it; OC::OCRepresentation postTopic;