diff --git a/frameworks/ans/src/notification_local_live_view_button.cpp b/frameworks/ans/src/notification_local_live_view_button.cpp index 81d163d5172dc3e92962acafd51d732f81b50221..df5bb1d07b6c1cac9d7f5a7960c0345e3ad2397d 100644 --- a/frameworks/ans/src/notification_local_live_view_button.cpp +++ b/frameworks/ans/src/notification_local_live_view_button.cpp @@ -172,6 +172,7 @@ NotificationLocalLiveViewButton *NotificationLocalLiveViewButton::FromJson(const auto pIcon = AnsImageUtil::UnPackImage(iconObj.get()); if (pIcon == nullptr) { ANS_LOGE("Failed to parse button icon"); + delete button; return nullptr; } button->buttonIcons_.emplace_back(pIcon); diff --git a/frameworks/ans/src/notification_request.cpp b/frameworks/ans/src/notification_request.cpp index 90ce7593486c13fca27bddeca10d05d167fa7a98..abb966fe2c0898509998083cd1330e26be7729ef 100644 --- a/frameworks/ans/src/notification_request.cpp +++ b/frameworks/ans/src/notification_request.cpp @@ -2255,7 +2255,7 @@ bool NotificationRequest::ConvertJsonToNotificationDistributedOptions( target->distributedOptions_ = *pOpt; } } - + delete pOpt; return true; }