Fix for defects detected by static analysis in Group-manager.
authorjyong2.kim <jyong2.kim@samsung.com>
Sun, 28 Feb 2016 23:17:15 +0000 (08:17 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 29 Feb 2016 04:51:42 +0000 (04:51 +0000)
sceneserver sample is fixed for excetpion catch.
memory deallocate with OICFree() in SceneUtil class.

Change-Id: I258e60a504052a59225cac2506553beaf1a1bd29
Signed-off-by: jyong2.kim <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5237
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/scene-manager/sampleapp/linux/sceneserver.cpp
service/scene-manager/src/SceneUtils.cpp

index fb40121..cfef6ae 100755 (executable)
@@ -238,6 +238,10 @@ bool discoverResource()
     {
          std::cout << e.what() << std::endl;
     }
+    catch(const RCSException& e)
+    {
+        std::cout << e.what() << std::endl;
+    }
     std::unique_lock<std::mutex> lck(mtx);
 
     cond.wait_for(lck, std::chrono::seconds(4));
index 8b1487f..b2000f6 100644 (file)
@@ -81,7 +81,7 @@ namespace OIC
 
             if (size == 0)
             {
-                delete[] netInfo;
+                OICFree(netInfo);
                 throw RCSException("Disabled Network");
             }
 
@@ -92,12 +92,12 @@ namespace OIC
                     std::string retAddress
                         = std::string(netInfo[i]->addr) + ":" + std::to_string(netInfo[i]->port);
 
-                    delete[] netInfo;
+                    OICFree(netInfo);
                     return retAddress;
                 }
             }
 
-            delete[] netInfo;
+            OICFree(netInfo);
             throw RCSException("Not supported Network");
         }