summaryrefslogtreecommitdiff
path: root/sdm/libs/hwc2/hwc_buffer_allocator.cpp
diff options
context:
space:
mode:
authorPramodh Kumar Mukunda <pkmuku@codeaurora.org>2017-06-15 16:18:51 +0530
committerUday Kiran Pichika <pichika@codeaurora.org>2017-07-26 11:43:11 +0530
commit927729d9ea68ff83e3bbdf9607a2ac0f23a5743a (patch)
treeab36b9884fb32593759dfa6427a6fe7a248dcd1e /sdm/libs/hwc2/hwc_buffer_allocator.cpp
parent65788dca88783d1a28e57544220b851dc68f5c66 (diff)
sdm: fix null pointer dereference and vector initialization.
Change-Id: I25bb8daa6b49223a443a31d1ae17560ed6fca486 Signed-off-by: Pramodh Kumar Mukunda <pkmuku@codeaurora.org>
Diffstat (limited to 'sdm/libs/hwc2/hwc_buffer_allocator.cpp')
-rw-r--r--sdm/libs/hwc2/hwc_buffer_allocator.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/sdm/libs/hwc2/hwc_buffer_allocator.cpp b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
index a1b763ca..0e05ca9d 100644
--- a/sdm/libs/hwc2/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
@@ -48,12 +48,14 @@ HWCBufferAllocator::HWCBufferAllocator() {
} else {
gralloc1_open(module_, &gralloc_device_);
}
- ReleaseBuffer_ = reinterpret_cast<GRALLOC1_PFN_RELEASE>(
- gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_RELEASE));
- Perform_ = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
- gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_PERFORM));
- Lock_ = reinterpret_cast<GRALLOC1_PFN_LOCK>(
- gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_LOCK));
+ if (gralloc_device_ != nullptr) {
+ ReleaseBuffer_ = reinterpret_cast<GRALLOC1_PFN_RELEASE>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_RELEASE));
+ Perform_ = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_PERFORM));
+ Lock_ = reinterpret_cast<GRALLOC1_PFN_LOCK>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_LOCK));
+ }
}
HWCBufferAllocator::~HWCBufferAllocator() {