summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steve Critchlow <steve.critchlow@sonymobile.com> 2012-07-10 14:09:10 +0200
committer Henrik Baard <henrik.baard@sonymobile.com> 2012-07-10 14:09:10 +0200
commit47ad361cee48a026c8c3695da04aab75e1e7b925 (patch)
tree6c29e0aef7141053639b50399558a0ed58f3f68c
parentdb1597a98958b78dc0d8eced19ae1406382b70d6 (diff)
Fix error trap in SurfaceTexture Client
There was an issue in Surface::lock where failure to lock a surface resulted in two bad things happening: - success was returned to the caller (it was apparently locked). - an uninitialised pointer was returned as the buffer. Change-Id: I8b0df81400e0fa0542a8bb993d76923ac96b686e
-rw-r--r--libs/gui/SurfaceTextureClient.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 36a81a6661..f60f9020c2 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -757,12 +757,16 @@ status_t SurfaceTextureClient::lock(
ALOGW_IF(res, "failed locking buffer (handle = %p)",
backBuffer->handle);
- mLockedBuffer = backBuffer;
- outBuffer->width = backBuffer->width;
- outBuffer->height = backBuffer->height;
- outBuffer->stride = backBuffer->stride;
- outBuffer->format = backBuffer->format;
- outBuffer->bits = vaddr;
+ if (res != 0) {
+ err = INVALID_OPERATION;
+ } else {
+ mLockedBuffer = backBuffer;
+ outBuffer->width = backBuffer->width;
+ outBuffer->height = backBuffer->height;
+ outBuffer->stride = backBuffer->stride;
+ outBuffer->format = backBuffer->format;
+ outBuffer->bits = vaddr;
+ }
}
}
return err;