hikey: Check framebuffer memory allocation am: 58c515baa9
am: 7d36a5fa58
Change-Id: I9b8496e3f8bd0c69722e10a90dba22013f8cccc6
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 */