mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-28 17:44:10 +00:00
gpu_display: don't dereference NULL if alloc fails
dwl_context_new() did not check if the allocation failed before using the returned pointer. BUG=None TEST=tools/dev_container tools/presubmit Change-Id: Ibeb0fb0b0a6e434657f09f8c24a7bd6ff7f8c21a Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5634619 Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
9227b78c4f
commit
51cf0f429d
1 changed files with 2 additions and 0 deletions
|
@ -723,6 +723,8 @@ static void error_callback_stub(const char *message) {
|
|||
struct dwl_context *dwl_context_new(dwl_error_callback_type error_callback)
|
||||
{
|
||||
struct dwl_context *ctx = calloc(1, sizeof(struct dwl_context));
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
ctx->ifaces.context = ctx;
|
||||
ctx->error_callback = error_callback ? error_callback : error_callback_stub;
|
||||
return ctx;
|
||||
|
|
Loading…
Reference in a new issue