From c41a4826d145d592c7c9ed4b4b35cc27ff2e0b9b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 2 Dec 2022 19:00:37 -0800 Subject: [PATCH] init: Do not invoke the ServiceList destructor when exiting From the Google C++ style guide: "Objects with static storage duration are forbidden unless they are trivially destructible." Hence this CL. Bug: 213617178 Change-Id: I4c9a51618ee1eb14ed439295a5fc0101b940a63d Signed-off-by: Bart Van Assche --- init/service_list.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/service_list.cpp b/init/service_list.cpp index 3047821fc..937d82e20 100644 --- a/init/service_list.cpp +++ b/init/service_list.cpp @@ -24,8 +24,8 @@ namespace init { ServiceList::ServiceList() {} ServiceList& ServiceList::GetInstance() { - static ServiceList instance; - return instance; + static ServiceList* instance = new ServiceList; + return *instance; } size_t ServiceList::CheckAllCommands() {