zink: handle calloc-failure
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 27 Nov 2019 16:31:28 +0000 (17:31 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 29 Nov 2019 08:54:25 +0000 (09:54 +0100)
In case we fail to allocate the context, we should notice and fail
gracefully.

CoverityID: 1455193
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/zink/zink_context.c

index 9b057fa165e6f8092d56f2349269c23d8a86add8..f79e289727d61a253edadb2e5ecffe33bc652e01 100644 (file)
@@ -1041,6 +1041,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
 {
    struct zink_screen *screen = zink_screen(pscreen);
    struct zink_context *ctx = CALLOC_STRUCT(zink_context);
+   if (!ctx)
+      goto fail;
 
    ctx->base.screen = pscreen;
    ctx->base.priv = priv;