hwc: Add NULL check for gralloc private_hnd_t
Add NULL check for private_hnd_t before assigning to a buffer. Change-Id: I302be85a68cf024740223faf718081c390f73b61
This commit is contained in:
@@ -328,18 +328,20 @@ int gralloc_perform(struct gralloc_module_t const* module,
|
|||||||
native_handle_t** handle = va_arg(args, native_handle_t**);
|
native_handle_t** handle = va_arg(args, native_handle_t**);
|
||||||
private_handle_t* hnd = (private_handle_t*)native_handle_create(
|
private_handle_t* hnd = (private_handle_t*)native_handle_create(
|
||||||
private_handle_t::sNumFds, private_handle_t::sNumInts());
|
private_handle_t::sNumFds, private_handle_t::sNumInts());
|
||||||
hnd->magic = private_handle_t::sMagic;
|
if (hnd) {
|
||||||
hnd->fd = fd;
|
hnd->magic = private_handle_t::sMagic;
|
||||||
hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
|
hnd->fd = fd;
|
||||||
hnd->size = size;
|
hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
|
||||||
hnd->offset = offset;
|
hnd->size = size;
|
||||||
hnd->base = uint64_t(base) + offset;
|
hnd->offset = offset;
|
||||||
hnd->gpuaddr = 0;
|
hnd->base = uint64_t(base) + offset;
|
||||||
hnd->width = width;
|
hnd->gpuaddr = 0;
|
||||||
hnd->height = height;
|
hnd->width = width;
|
||||||
hnd->format = format;
|
hnd->height = height;
|
||||||
*handle = (native_handle_t *)hnd;
|
hnd->format = format;
|
||||||
res = 0;
|
*handle = (native_handle_t *)hnd;
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user