From: Hyunjin Park Date: Thu, 10 Sep 2015 11:18:35 +0000 (+0900) Subject: [notification] fix prevent CID 23603, 24335 X-Git-Tag: submit/tizen/20151026.073646^2^2~114^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c3c43d7c0d3451f2fe12a0179efbdfbf23335be;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [notification] fix prevent CID 23603, 24335 - SCOPE_EXIT position is after return statement. - move it before return statement. - TCT result : 100% passed Change-Id: I17ce78347220872d6062b4ec1f440cf0293d6f11 --- diff --git a/src/notification/notification_manager.cc b/src/notification/notification_manager.cc index 9da44d4e..c9c1f410 100644 --- a/src/notification/notification_manager.cc +++ b/src/notification/notification_manager.cc @@ -98,13 +98,7 @@ PlatformResult NotificationManager::Get(const picojson::object& args, int id = std::stoi(FromJson(args, "id")); app_control_h app_control = nullptr; - notification_h noti_handle; - PlatformResult status = StatusNotification::GetNotiHandle(id, ¬i_handle); - if (status.IsError()) - { - LoggerE("Failed: GetNotiHandle"); - return status; - } + notification_h noti_handle = nullptr; SCOPE_EXIT { if (app_control) { @@ -113,6 +107,13 @@ PlatformResult NotificationManager::Get(const picojson::object& args, free(noti_handle); }; + PlatformResult status = StatusNotification::GetNotiHandle(id, ¬i_handle); + if (status.IsError()) + { + LoggerE("Failed: GetNotiHandle"); + return status; + } + status = StatusNotification::GetAppControl(noti_handle, &app_control); if (status.IsError()) { diff --git a/src/notification/status_notification.cc b/src/notification/status_notification.cc index efd69b4c..73aa21e5 100644 --- a/src/notification/status_notification.cc +++ b/src/notification/status_notification.cc @@ -1172,8 +1172,16 @@ PlatformResult StatusNotification::FromJson(const picojson::object& args, int id = NOTIFICATION_PRIV_ID_NONE; int ret; - notification_h noti_handle; + notification_h noti_handle = nullptr; app_control_h app_control = NULL; + + SCOPE_EXIT { + if (app_control) { + app_control_destroy(app_control); + } + free(noti_handle); + }; + if (is_update) { id = std::stoi(common::FromJson(noti_obj, "id")); @@ -1187,13 +1195,6 @@ PlatformResult StatusNotification::FromJson(const picojson::object& args, return status; } - SCOPE_EXIT { - if (app_control) { - app_control_destroy(app_control); - } - free(noti_handle); - }; - status = SetLayout(noti_handle, status_type); if (status.IsError()) { return status;