From: Seungha Son Date: Fri, 18 Aug 2017 04:47:30 +0000 (+0900) Subject: Fix memory leak X-Git-Tag: accepted/tizen/3.0/common/20170821.093636^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9edacac2527cf371deb572de0c3f7c252c49b6c;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Fix memory leak Signed-off-by: Seungha Son Change-Id: Ic777cdeb6517bc87e56d1671cd810edf8babbf5c --- diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 17a3ef9..8edeb06 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -31,6 +31,7 @@ #include #include +#include #include @@ -392,8 +393,11 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { application->launch_mode = strdup(app_info->launch_mode().c_str()); for (auto& icon : GListRange(manifest->icon)) { icon_x* app_icon = reinterpret_cast(calloc(1, sizeof(icon_x))); - if (!app_icon) + if (!app_icon) { + LOG(ERROR) << "Out of memory"; + pkgmgrinfo_basic_free_application(application); return false; + } app_icon->text = strdup(icon->text); app_icon->lang = strdup(icon->lang); application->icon = g_list_append(application->icon, app_icon); @@ -442,8 +446,11 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { bf::path icon_path = context_->root_application_path.get() / manifest->package / "res" / "wgt" / service_info.icon(); icon_x* icon = reinterpret_cast(calloc(1, sizeof(icon_x))); - if (!icon) + if (!icon) { + LOG(ERROR) << "Out of memory"; + pkgmgrinfo_basic_free_application(application); return false; + } icon->text = strdup(icon_path.c_str()); icon->lang = strdup(DEFAULT_LOCALE); application->icon = g_list_append(application->icon, icon); @@ -504,8 +511,11 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { if (!app_widget.icon_src.empty()) { icon_x* icon = reinterpret_cast(calloc(1, sizeof(icon_x))); - if (!icon) + if (!icon) { + LOG(ERROR) << "Out of memory"; + pkgmgrinfo_basic_free_application(application); return false; + } icon->text = strdup(app_widget.icon_src.c_str()); icon->lang = strdup(DEFAULT_LOCALE); application->icon = g_list_append(application->icon, icon);