SimpleUI::rotationType memory leak corrected 70/91070/5
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Wed, 5 Oct 2016 13:51:31 +0000 (15:51 +0200)
committerMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Fri, 7 Oct 2016 07:06:59 +0000 (00:06 -0700)
[Issue]        http://suprem.sec.samsung.net/jira/browse/TWF-2192
[Problem]      Undeleted alocated memory
[Solution]     Changed to simple variable
[Verify]       Run and rotate device

Change-Id: I703960cc863b8704c72896c899df7dcb65a2ec4e
Signed-off-by: Maciej Skrzypkowski <m.skrzypkows@samsung.com>
services/SimpleUI/SimpleUI.cpp

index 285fa74ca8768bee366b3a68ed4c599d9c77df07..87f991f9ecc3db06fc10def45a6c16f7369c2b2c 100755 (executable)
@@ -1285,24 +1285,26 @@ int SimpleUI::getRotation()
 void SimpleUI::rotationType(rotationLock lock)
 {
     BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-    int *rots;
-    size_t size = 1;
-    switch (lock)
-    {
-        case rotationLock::portrait:
-            rots = new int[1] {0};
+
+    switch (lock) {
+        case rotationLock::portrait: {
+            const int rots[] = {0};
+            elm_win_wm_rotation_available_rotations_set(main_window, rots, sizeof(rots)/sizeof(int));
             break;
-        case rotationLock::landscape:
-            rots = new int[1] {90};
+        }
+        case rotationLock::landscape: {
+            const int rots[] = {90};
+            elm_win_wm_rotation_available_rotations_set(main_window, rots, sizeof(rots)/sizeof(int));
             break;
-        case rotationLock::noLock:
-        default:
-            rots = new int[4] {0, 90, 180, 270};
-            size = 4;
+        }
+        case rotationLock::noLock: {
+            const int rots[] = {0, 90, 180, 270};
+            elm_win_wm_rotation_available_rotations_set(main_window, rots, sizeof(rots)/sizeof(int));
             break;
+        }
+        default:
+            BROWSER_LOGW("[%s:%d] Unknown rotationLock case!", __PRETTY_FUNCTION__, __LINE__);
     }
-
-    elm_win_wm_rotation_available_rotations_set( main_window, const_cast<const int*>(rots), size);
 }
 
 Evas_Object* SimpleUI::getMainWindow()