From a17911ceb11fbf14b296095a9b5c506295b73d99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Wed, 13 Apr 2016 10:55:29 -0500 Subject: [PATCH] gallium/radeon: handle failure when mapping staging buffer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Cc: "11.1 11.2" Reviewed-by: Marek Olšák --- src/gallium/drivers/radeon/r600_buffer_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 47514e91d23..664dc5bfdce 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -376,6 +376,10 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx, 0, 0, resource, level, box); data = r600_buffer_map_sync_with_rings(rctx, staging, PIPE_TRANSFER_READ); + if (!data) { + pipe_resource_reference((struct pipe_resource **)&staging, NULL); + return NULL; + } data += box->x % R600_MAP_BUFFER_ALIGNMENT; return r600_buffer_get_transfer(ctx, resource, level, usage, box, -- 2.30.2