From 542f365adb39027f50b8d7b957404ad69c767035 Mon Sep 17 00:00:00 2001 From: "huiyu,eun" Date: Wed, 20 Sep 2017 18:51:44 +0900 Subject: [PATCH] Fix svace issues - fix memory leak. - fix dereferenced pointer Change-Id: Idb3e131a9ebe3881573723787b73c14c5d801851 Signed-off-by: huiyu,eun --- adaptors/ecore/wayland/window-impl-ecore-wl.cpp | 10 ++++++++-- adaptors/widget/internal/widget-impl.cpp | 15 ++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp index 971be10..6a71e00 100644 --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -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; diff --git a/adaptors/widget/internal/widget-impl.cpp b/adaptors/widget/internal/widget-impl.cpp index b16f1eb..877bf79 100644 --- a/adaptors/widget/internal/widget-impl.cpp +++ b/adaptors/widget/internal/widget-impl.cpp @@ -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; -- 2.7.4