gralloc1: Do not do early validation on Release

Check if handle exists in map first.
CRs-Fixed: 2074655
Change-Id: Ia928f1f09578b9ab21479ce237a56555f29ca9c5
This commit is contained in:
Naseer Ahmed
2017-07-07 18:50:49 -04:00
committed by Gerrit - the friendly Code Review server
parent 9f82642b7b
commit a186b47650
2 changed files with 13 additions and 8 deletions

View File

@@ -392,14 +392,13 @@ gralloc1_error_t GrallocImpl::RetainBuffer(gralloc1_device_t *device, buffer_han
}
gralloc1_error_t GrallocImpl::ReleaseBuffer(gralloc1_device_t *device, buffer_handle_t buffer) {
gralloc1_error_t status = CheckDeviceAndHandle(device, buffer);
if (status == GRALLOC1_ERROR_NONE) {
const private_handle_t *hnd = PRIV_HANDLE_CONST(buffer);
GrallocImpl const *dev = GRALLOC_IMPL(device);
status = dev->buf_mgr_->ReleaseBuffer(hnd);
if (!device || !buffer) {
return GRALLOC1_ERROR_BAD_DESCRIPTOR;
}
return status;
const private_handle_t *hnd = PRIV_HANDLE_CONST(buffer);
GrallocImpl const *dev = GRALLOC_IMPL(device);
return dev->buf_mgr_->ReleaseBuffer(hnd);
}
gralloc1_error_t GrallocImpl::GetNumFlexPlanes(gralloc1_device_t *device, buffer_handle_t buffer,