diff options
author | Jinguang Dong <dongjinguang@huawei.com> | 2017-05-02 10:20:19 +0800 |
---|---|---|
committer | Jinguang Dong <dongjinguang@huawei.com> | 2017-05-03 09:24:24 +0800 |
commit | 58c515baa9c4033f0e2ab2dd24face545a396970 (patch) | |
tree | 05a686f15b76d6aa2e55f93106abcbe4997c9a9f | |
parent | 66f0c4b7794c21215333a654758c9613585625c1 (diff) | |
download | hikey-58c515baa9c4033f0e2ab2dd24face545a396970.tar.gz |
hikey: Check framebuffer memory allocationandroid-wear-o-preview-4android-wear-o-preview-3android-o-preview-2
Resolve the crash when the framebuffer dev malloc failed
Test: Compiles and device boots up.
Change-Id: Idb0d0038d351c1ac71c289799f7fd639728f40b7
-rw-r--r-- | gralloc/framebuffer_device.cpp | 6 |
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 */ |