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,6 +328,7 @@ 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());
|
||||||
|
if (hnd) {
|
||||||
hnd->magic = private_handle_t::sMagic;
|
hnd->magic = private_handle_t::sMagic;
|
||||||
hnd->fd = fd;
|
hnd->fd = fd;
|
||||||
hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
|
hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
|
||||||
@@ -340,6 +341,7 @@ int gralloc_perform(struct gralloc_module_t const* module,
|
|||||||
hnd->format = format;
|
hnd->format = format;
|
||||||
*handle = (native_handle_t *)hnd;
|
*handle = (native_handle_t *)hnd;
|
||||||
res = 0;
|
res = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user