From 2583c250c288835a0b8e002b4ea04ec545f184d3 Mon Sep 17 00:00:00 2001 From: Venkat Thogaru Date: Tue, 16 Jun 2020 16:02:12 +0530 Subject: [PATCH] display: Fix null pointer dereference Change-Id: Iff047b79330854c2e2bd8fd07f18c842dec0bc2d --- services/config/src/device_impl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp index 8d036cda..6cbdb18d 100644 --- a/services/config/src/device_impl.cpp +++ b/services/config/src/device_impl.cpp @@ -575,6 +575,10 @@ void DeviceImpl::DeviceClientContext::ParseGetSupportedDsiBitclks(const ByteStre int32_t error = intf_->GetSupportedDSIBitClks(*disp_id, &bit_clks); bit_clks_data = reinterpret_cast(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]; }