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