commonsys: services: Delete device_obj_ to release the memory
This deletes device_obj_ to release the memory appropriately
on init failure case.
Change-Id: Ide62aed02c7fcf9fbb8d4376c805fc50277b00cc
diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp
index 4541368..2361ab0 100644
--- a/services/config/src/device_impl.cpp
+++ b/services/config/src/device_impl.cpp
@@ -85,6 +85,7 @@
android::status_t status = device_obj_->IDisplayConfig::registerAsService();
// Unable to start Display Config 2.0 service. Fail Init.
if (status != android::OK) {
+ delete device_obj_;
device_obj_ = nullptr;
return -1;
}