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
This commit is contained in:
Steve Critchlow 2012-07-10 14:09:10 +02:00 committed by Henrik Baard
parent db1597a989
commit 47ad361cee

View File

@ -757,6 +757,9 @@ status_t SurfaceTextureClient::lock(
ALOGW_IF(res, "failed locking buffer (handle = %p)",
backBuffer->handle);
if (res != 0) {
err = INVALID_OPERATION;
} else {
mLockedBuffer = backBuffer;
outBuffer->width = backBuffer->width;
outBuffer->height = backBuffer->height;
@ -765,6 +768,7 @@ status_t SurfaceTextureClient::lock(
outBuffer->bits = vaddr;
}
}
}
return err;
}