[notification] fix prevent CID 24596
authorHyunjin Park <hj.na.park@samsung.com>
Wed, 9 Sep 2015 05:09:52 +0000 (14:09 +0900)
committerHyunjin Park <hj.na.park@samsung.com>
Wed, 9 Sep 2015 06:07:04 +0000 (15:07 +0900)
- add SCOPE_EXIT to prevent resource leak
- TCT result : 100% passed

Change-Id: Ibac5e2c719c092d56804921a0876f5597dd8cbb6

src/notification/notification_manager.cc

index ef17319bfcbdf0116af274a10caf547bf8b0b742..9da44d4e26e8f243701f2b67b7ebe6acc9b8add4 100644 (file)
@@ -168,9 +168,16 @@ PlatformResult NotificationManager::GetAll(picojson::array& out) {
                               "Cannot get notification id error");
       }
 
-      app_control_h app_control;
+      app_control_h app_control = nullptr;
       PlatformResult status =
           StatusNotification::GetAppControl(noti, &app_control);
+
+      SCOPE_EXIT {
+          if (app_control) {
+              app_control_destroy(app_control);
+          }
+      };
+
       if (status.IsError())
         return status;