summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJignesh Mehta <jigneshm@codeaurora.org>2020-08-19 21:59:08 -0700
committerJignesh Mehta <jigneshm@codeaurora.org>2020-08-19 22:01:14 -0700
commit9e5f7876e2b01a9e6208a63d8cf5209f6d614d7b (patch)
treeec6c213f94360a96dff8eed54f48a02ba8b50bbc
parentb191be42a41a98c430ea7ab31ae5dfea5dd83321 (diff)
Add null check for lights smart pointer
lights smart pointer was used without null pointer check. This change adds null check. Change-Id: Ifdd82290cfe4d7ca781adbed8c8a65961c70e244
-rw-r--r--lights/main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lights/main.cpp b/lights/main.cpp
index 5bab50d..95cb6d8 100644
--- a/lights/main.cpp
+++ b/lights/main.cpp
@@ -24,6 +24,9 @@ using ::aidl::android::hardware::light::Lights;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Lights> lights = ndk::SharedRefBase::make<Lights>();
+ 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());