[Mesa-dev] [PATCH 1/2] util: handle failed mapping in u_upload_alloc_buffer()
Brian Paul
brian.e.paul at gmail.com
Mon Oct 24 08:40:24 PDT 2011
From: Brian Paul <brianp at vmware.com>
---
src/gallium/auxiliary/util/u_upload_mgr.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 9bcc1bb..aef4d40 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -141,7 +141,12 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
PIPE_TRANSFER_WRITE |
PIPE_TRANSFER_FLUSH_EXPLICIT,
&upload->transfer);
-
+ if (upload->map == NULL) {
+ upload->size = 0;
+ pipe_resource_reference(&upload->buffer, NULL);
+ return PIPE_ERROR_OUT_OF_MEMORY;
+ }
+
upload->size = size;
upload->offset = 0;
--
1.7.3.4
More information about the mesa-dev
mailing list