From ba3776a102569303578858a77d96b3b5e43dfcc0 Mon Sep 17 00:00:00 2001 From: Marcin Bialek Date: Wed, 2 Mar 2022 12:58:36 +0100 Subject: [PATCH] [Notification] Fix memory leak. [Verification] Code compiles. Change-Id: I9e75cfd1d91021eb7a8bb074bcd0505c8002997b --- src/notification/common_notification.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.34.1