hikey: Check framebuffer memory allocation am: 58c515baa9 am: 7d36a5fa58 am: f33804a7a4
am: 87cdefe6d8
Change-Id: I26b4a20e54809c42eac22d51f2427ba79ffee59c
diff --git a/gralloc/framebuffer_device.cpp b/gralloc/framebuffer_device.cpp
index cfc480f..3004778 100644
--- a/gralloc/framebuffer_device.cpp
+++ b/gralloc/framebuffer_device.cpp
@@ -469,6 +469,12 @@
/* 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 */