summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-10-24 09:37:26 -0600
committerBrian Paul <[email protected]>2011-10-24 16:39:58 -0600
commit19961da4cb115ca930186bef41fb92740fdd09d1 (patch)
tree88509e06366994276448dc68322af2f59be498fa /src/gallium
parent4e6a0b40c5bb31101718f25ffaff8ffeb3d921b9 (diff)
util: handle failed mapping in u_upload_alloc_buffer()
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c7
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 9bcc1bb0c6b..aef4d409c2c 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;