From 3361e6cd2bed24aeebddc4f8dead897c964c4ba0 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 1 Jun 2022 19:53:51 +0800 Subject: [PATCH] Signed-off-by: lovechinamo Changes to be committed: --- services/src/input_method_system_ability.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 7c7c6e8..aa9ab40 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -208,12 +208,14 @@ namespace MiscServices { std::map::const_iterator it = msgHandlers.find(MAIN_USER_ID); if (it == msgHandlers.end()) { IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler"); - sptr handler = new MessageHandler(); + MessageHandler *handler = new MessageHandler(); if (session) { IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is not nullptr"); session->CreateWorkThread(*handler); msgHandlers.insert(std::pair(MAIN_USER_ID, handler)); } + delete handler; + handler = nullptr; } bool isStartSuccess = false;