display: Fix null pointer dereference
Change-Id: Iff047b79330854c2e2bd8fd07f18c842dec0bc2d
diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp
index 8d036cd..6cbdb18 100644
--- a/services/config/src/device_impl.cpp
+++ b/services/config/src/device_impl.cpp
@@ -575,6 +575,10 @@
int32_t error = intf_->GetSupportedDSIBitClks(*disp_id, &bit_clks);
bit_clks_data = reinterpret_cast<uint64_t *>(malloc(sizeof(uint64_t) * bit_clks.size()));
+ if (bit_clks_data == NULL) {
+ _hidl_cb(-EINVAL, {}, {});
+ return;
+ }
for (int i = 0; i < bit_clks.size(); i++) {
bit_clks_data[i] = bit_clks[i];
}