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:
Ramakant Singh
2015-03-23 15:01:12 +05:30
parent 3c5a16f718
commit 04b6b241cf

View File

@@ -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;
} }