diff options
author | Jesse Hall <jessehall@google.com> | 2013-08-13 12:06:31 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-13 12:06:31 -0700 |
commit | 771ed8d71be8c851991164cd10fcfbf2431df86d (patch) | |
tree | ce345ce77679e144a5cdd0484b3c8e6b48daa90b /libs | |
parent | 6f23562e0c112bc5c6159c745d8af755cc530d77 (diff) | |
parent | fc43e16a5693bca0edfc82c650fb606971e47138 (diff) | |
download | frameworks_native-771ed8d71be8c851991164cd10fcfbf2431df86d.zip frameworks_native-771ed8d71be8c851991164cd10fcfbf2431df86d.tar.gz frameworks_native-771ed8d71be8c851991164cd10fcfbf2431df86d.tar.bz2 |
am fc43e16a: Merge "Graphics:Add error check when create GraphicBuffer"
* commit 'fc43e16a5693bca0edfc82c650fb606971e47138':
Graphics:Add error check when create GraphicBuffer
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/IGraphicBufferProducer.cpp | 6 | ||||
-rw-r--r-- | libs/ui/GraphicBuffer.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp index e3d2a20..b7625f2 100644 --- a/libs/gui/IGraphicBufferProducer.cpp +++ b/libs/gui/IGraphicBufferProducer.cpp @@ -61,7 +61,11 @@ public: 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; diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index 0ecd3d9..96a7188 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -282,6 +282,8 @@ status_t GraphicBuffer::unflatten( if (handle != 0) { status_t err = mBufferMapper.registerBuffer(handle); if (err != NO_ERROR) { + width = height = stride = format = usage = 0; + handle = NULL; ALOGE("unflatten: registerBuffer failed: %s (%d)", strerror(-err), err); return err; |