Mesa (master): zink: handle calloc-failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 29 09:19:23 UTC 2019


Module: Mesa
Branch: master
Commit: 8e1dca35abe13b57b34ea30d14f9ed55f558af14
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e1dca35abe13b57b34ea30d14f9ed55f558af14

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Nov 27 17:31:28 2019 +0100

zink: handle calloc-failure

In case we fail to allocate the context, we should notice and fail
gracefully.

CoverityID: 1455193
Reviewed-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/zink/zink_context.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 9b057fa165e..f79e289727d 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -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;




More information about the mesa-commit mailing list