Bug fix about result of static anlayzer.
authorjaesick.shin <jaesick.shin@samsung.com>
Fri, 14 Oct 2016 06:07:54 +0000 (15:07 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 18 Oct 2016 04:12:36 +0000 (04:12 +0000)
this patch include,
bug fix about memory leak and coding idiom.

Change-Id: I6fba4a8b182ce88cda44571ebb490c7573812c01
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13267
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/notification/cpp-wrapper/unittest/NSProviderServiceTest.cpp
service/notification/unittest/NSConsumerSimulator.h

index e1b9f02..be8e416 100755 (executable)
@@ -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)
index bd0a6e3..f3183a9 100644 (file)
@@ -194,7 +194,8 @@ private:
             std::vector<OC::OCRepresentation> postTopicArr;
 
             for(std::vector<OC::OCRepresentation>::iterator it = topicArr.begin();
-                    it != topicArr.end(); ++it) {
+                    it != topicArr.end(); ++it)
+            {
                 /* std::cout << *it; ... */
                 OC::OCRepresentation topic = *it;
                 OC::OCRepresentation postTopic;