From: Marcin Bialek Date: Wed, 2 Mar 2022 11:58:36 +0000 (+0100) Subject: [Notification] Fix memory leak. X-Git-Tag: submit/tizen/20220302.124449^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba3776a102569303578858a77d96b3b5e43dfcc0;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Notification] Fix memory leak. [Verification] Code compiles. Change-Id: I9e75cfd1d91021eb7a8bb074bcd0505c8002997b --- diff --git a/src/notification/common_notification.cc b/src/notification/common_notification.cc index cee40841..cd03304b 100644 --- a/src/notification/common_notification.cc +++ b/src/notification/common_notification.cc @@ -745,7 +745,7 @@ PlatformResult CommonNotification::GetEventHandler(notification_h noti_handle, notification_event_type_e event_type, app_control_h* event_handler) { ScopeLogger(); - app_control_h handler; + app_control_h handler = nullptr; int ret = notification_get_event_handler(noti_handle, event_type, &handler); if (NOTIFICATION_ERROR_NONE != ret) { @@ -755,6 +755,8 @@ PlatformResult CommonNotification::GetEventHandler(notification_h noti_handle, if (event_handler) { *event_handler = handler; + } else { + app_control_destroy(handler); } return PlatformResult(ErrorCode::NO_ERROR);