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 <bvanassche@google.com>
diff --git a/init/service_list.cpp b/init/service_list.cpp
index 3047821..937d82e 100644
--- a/init/service_list.cpp
+++ b/init/service_list.cpp
@@ -24,8 +24,8 @@
ServiceList::ServiceList() {}
ServiceList& ServiceList::GetInstance() {
- static ServiceList instance;
- return instance;
+ static ServiceList* instance = new ServiceList;
+ return *instance;
}
size_t ServiceList::CheckAllCommands() {