Graphics:Add error check when create GraphicBuffer
Change-Id: Ib0ca59bf1dfe4ae0266c29c91c1dbe3d02c0904e
Author: Lingyun Zhu <lingyun.zhu@intel.com>
Signed-off-by: Lingyun Zhu <lingyun.zhu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 50141
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp
index 63d7628..c335439 100644
--- a/libs/gui/IGraphicBufferProducer.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -62,7 +62,11 @@
bool nonNull = reply.readInt32();
if (nonNull) {
*buf = new GraphicBuffer();
- reply.read(**buf);
+ result = reply.read(**buf);
+ if(result != NO_ERROR) {
+ (*buf).clear();
+ return result;
+ }
}
result = reply.readInt32();
return result;