summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinguang Dong <dongjinguang@huawei.com>2017-05-02 10:20:19 +0800
committerJinguang Dong <dongjinguang@huawei.com>2017-05-03 09:24:24 +0800
commit58c515baa9c4033f0e2ab2dd24face545a396970 (patch)
tree05a686f15b76d6aa2e55f93106abcbe4997c9a9f
parent66f0c4b7794c21215333a654758c9613585625c1 (diff)
downloadhikey-58c515baa9c4033f0e2ab2dd24face545a396970.tar.gz
Resolve the crash when the framebuffer dev malloc failed Test: Compiles and device boots up. Change-Id: Idb0d0038d351c1ac71c289799f7fd639728f40b7
-rw-r--r--gralloc/framebuffer_device.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/gralloc/framebuffer_device.cpp b/gralloc/framebuffer_device.cpp
index cfc480fa..30047780 100644
--- a/gralloc/framebuffer_device.cpp
+++ b/gralloc/framebuffer_device.cpp
@@ -469,6 +469,12 @@ int framebuffer_device_open(hw_module_t const *module, const char *name, hw_devi
/* initialize our state here */
framebuffer_device_t *dev = (framebuffer_device_t *)malloc(sizeof(framebuffer_device_t));
+ if (dev == NULL)
+ {
+ AERR("Error to malloc the framebuffer (%s)", strerror(errno));
+ gralloc_close(gralloc_device);
+ return -ENOMEM;
+ }
memset(dev, 0, sizeof(*dev));
/* initialize the procs */