gallium/radeon: handle failure when mapping staging buffer
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 13 Apr 2016 15:55:29 +0000 (10:55 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 14 Apr 2016 21:29:23 +0000 (16:29 -0500)
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_buffer_common.c

index 47514e91d2340d60bd6050914a74a360a7492ae5..664dc5bfdce19756c9dab65e159ab52646a581c9 100644 (file)
@@ -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,