copybit: Fix crash when copy_image is called with Tile format

Add check for copy_image failure case.
CRs-Fixed: 393122

Change-Id: I5765120e87a135795d771c5d331275a66ade7e23
This commit is contained in:
Pawan Kumar 2012-09-03 09:14:13 +05:30 committed by Andrew Sutherland
parent 357ee6d8dc
commit b39f56b071

View File

@ -1174,7 +1174,14 @@ static int stretch_copybit_internal(
src_image.handle = src_hnd;
// Copy the source.
copy_image((private_handle_t *)src->handle, &src_image, CONVERT_TO_C2D_FORMAT);
status = copy_image((private_handle_t *)src->handle, &src_image,
CONVERT_TO_C2D_FORMAT);
if (status == COPYBIT_FAILURE) {
ALOGE("%s:copy_image failed in temp source",__FUNCTION__);
delete_handle(dst_hnd);
delete_handle(src_hnd);
return status;
}
// Flush the cache
IMemAlloc* memalloc = sAlloc->getAllocator(src_hnd->flags);
@ -1246,7 +1253,13 @@ static int stretch_copybit_internal(
trg_mapped);
if (needTempDestination) {
// copy the temp. destination without the alignment to the actual destination.
copy_image(dst_hnd, dst, CONVERT_TO_ANDROID_FORMAT);
status = copy_image(dst_hnd, dst, CONVERT_TO_ANDROID_FORMAT);
if (status == COPYBIT_FAILURE) {
ALOGE("%s:copy_image failed in temp Dest",__FUNCTION__);
delete_handle(dst_hnd);
delete_handle(src_hnd);
return status;
}
// Invalidate the cache.
IMemAlloc* memalloc = sAlloc->getAllocator(dst_hnd->flags);
memalloc->clean_buffer((void *)(dst_hnd->base), dst_hnd->size,