diff --git a/frameworks/ets/ani/app/context/src/ets_context_module.cpp b/frameworks/ets/ani/app/context/src/ets_context_module.cpp index 55154d7642..0640dc47d7 100644 --- a/frameworks/ets/ani/app/context/src/ets_context_module.cpp +++ b/frameworks/ets/ani/app/context/src/ets_context_module.cpp @@ -411,6 +411,7 @@ void EtsContextModule::SaveStaticBindingObject(ani_env *aniEnv, ani_object input ani_status status = ANI_ERROR; if ((status = aniEnv->GlobalReference_Create(input, contextGlobalRef)) != ANI_OK) { TAG_LOGE(AAFwkTag::UIABILITY, "status : %{public}d", status); + delete contextGlobalRef; return; } context->Bind(contextGlobalRef);