virgl: return error if allocating resolve_tmp fails
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 4 Apr 2019 10:36:08 +0000 (12:36 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 17 Apr 2019 07:27:08 +0000 (07:27 +0000)
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
src/gallium/drivers/virgl/virgl_texture.c

index d52062579d4a4d1d32c889872ed341b51d95e979..398d2ef9d4e688cab8c6c53026ecc87d6eb70f08 100644 (file)
@@ -135,6 +135,10 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx,
       virgl_init_temp_resource_from_box(&templ, resource, box, level, 0);
 
       trans->resolve_tmp = (struct virgl_resource *)ctx->screen->resource_create(ctx->screen, &templ);
+      if (!trans->resolve_tmp) {
+         virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
+         return NULL;
+      }
 
       virgl_copy_region_with_blit(ctx, &trans->resolve_tmp->u.b, 0, 0, 0, 0, resource, level, box);
       ctx->flush(ctx, NULL, 0);