r600g: check NULL return from r600_aligned_buffer_create
authorJulien Isorce <jisorce@oblong.com>
Thu, 23 Mar 2017 14:25:39 +0000 (14:25 +0000)
committerJulien Isorce <jisorce@oblong.com>
Tue, 28 Mar 2017 17:27:55 +0000 (18:27 +0100)
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/r600/r600_state.c

index 6139bd2f05ec328bf946986006e4050ceb2ae525..9ca113ac8835c5855e6bcaaf0c16ac4b28afea3d 100644 (file)
@@ -983,6 +983,11 @@ static void r600_init_color_surface(struct r600_context *rctx,
                                                           PIPE_USAGE_DEFAULT,
                                                           cmask.size, cmask.alignment);
 
+                       if (unlikely(!rctx->dummy_cmask)) {
+                               surf->color_initialized = false;
+                               return;
+                       }
+
                        /* Set the contents to 0xCC. */
                        ptr = pipe_buffer_map(&rctx->b.b, &rctx->dummy_cmask->b.b, PIPE_TRANSFER_WRITE, &transfer);
                        memset(ptr, 0xCC, cmask.size);
@@ -999,6 +1004,11 @@ static void r600_init_color_surface(struct r600_context *rctx,
                                r600_aligned_buffer_create(&rscreen->b.b, 0,
                                                           PIPE_USAGE_DEFAULT,
                                                           fmask.size, fmask.alignment);
+
+                       if (unlikely(!rctx->dummy_fmask)) {
+                               surf->color_initialized = false;
+                               return;
+                       }
                }
                r600_resource_reference(&surf->cb_buffer_fmask, rctx->dummy_fmask);