Fix svace issues 89/151389/2
authorhuiyu,eun <huiyu.eun@samsung.com>
Wed, 20 Sep 2017 09:51:44 +0000 (18:51 +0900)
committerhuiyu,eun <huiyu.eun@samsung.com>
Thu, 21 Sep 2017 00:56:32 +0000 (09:56 +0900)
- fix memory leak.
- fix dereferenced pointer

Change-Id: Idb3e131a9ebe3881573723787b73c14c5d801851
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/widget/internal/widget-impl.cpp

index 971be10..6a71e00 100644 (file)
@@ -211,7 +211,10 @@ struct Window::EventHandler
     if ( handler && handler->mWindow && transformEvent->output == ecore_wl_window_output_find( handler->mEcoreWindow ) )
     {
       ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      wlSurface->OutputTransformed();
+      if( wlSurface )
+      {
+        wlSurface->OutputTransformed();
+      }
     }
 
     return ECORE_CALLBACK_PASS_ON;
@@ -226,7 +229,10 @@ struct Window::EventHandler
     if ( handler && handler->mWindow && ignoreTransformEvent->win == handler->mEcoreWindow )
     {
       ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      wlSurface->OutputTransformed();
+      if( wlSurface )
+      {
+        wlSurface->OutputTransformed();
+      }
     }
 
     return ECORE_CALLBACK_PASS_ON;
index b16f1eb..877bf79 100644 (file)
@@ -58,7 +58,7 @@ static bool IsWidgetFeatureEnabled()
   int ret;
 
   if(retrieved == true)
-         return feature;
+    return feature;
 
   ret = system_info_get_platform_bool("http://tizen.org/feature/shell.appwidget", &feature);
   if(ret != SYSTEM_INFO_ERROR_NONE)
@@ -79,26 +79,26 @@ static int SendLifecycleEvent(const char* classId, const char* instanceId, int s
 
   if (bundleData == NULL)
   {
-         DALI_LOG_ERROR("out of memory");
-         return -1;
+    DALI_LOG_ERROR("out of memory");
+    return -1;
   }
 
   bundle_add_str(bundleData, AUL_K_WIDGET_ID, classId);
   bundle_add_str(bundleData, AUL_K_WIDGET_INSTANCE_ID, instanceId);
   bundle_add_byte(bundleData, AUL_K_WIDGET_STATUS, &status, sizeof(int));
 
-
   char temp[256] = {0, };
   char *packageId = NULL;
   if(aul_app_get_pkgid_bypid(getpid(), temp, sizeof(temp)) == 0)
   {
-         packageId = strdup(temp);
+    packageId = strdup(temp);
   }
 
   if(!packageId)
   {
-         DALI_LOG_ERROR("package_id is NULL");
-         return -1;
+    DALI_LOG_ERROR("package_id is NULL");
+    bundle_free(bundleData);
+    return -1;
   }
   bundle_add_str(bundleData, AUL_K_PKGID, packageId);
 
@@ -107,6 +107,7 @@ static int SendLifecycleEvent(const char* classId, const char* instanceId, int s
   if (ret < 0)
     DALI_LOG_ERROR("send lifecycle error:%d\n", ret);
 
+  free(packageId);
   bundle_free(bundleData);
 
   return ret;