From 123d8346a3bd05e6f54afb1814032cf452d740d0 Mon Sep 17 00:00:00 2001 From: Jignesh Mehta Date: Wed, 19 Aug 2020 21:59:08 -0700 Subject: [PATCH] sdm660-common: Add null check for lights smart pointer lights smart pointer was used without null pointer check. This change adds null check. Change-Id: Ifdd82290cfe4d7ca781adbed8c8a65961c70e244 Signed-off-by: pix106 --- light/aidl/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/light/aidl/main.cpp b/light/aidl/main.cpp index 5bab50d7..95cb6d85 100644 --- a/light/aidl/main.cpp +++ b/light/aidl/main.cpp @@ -24,6 +24,9 @@ using ::aidl::android::hardware::light::Lights; int main() { ABinderProcess_setThreadPoolMaxThreadCount(0); std::shared_ptr lights = ndk::SharedRefBase::make(); + if (!lights) { + return EXIT_FAILURE; + } const std::string instance = std::string() + Lights::descriptor + "/default"; binder_status_t status = AServiceManager_addService(lights->asBinder().get(), instance.c_str());