[Mesa-dev] [PATCH 2/2] util: handle failed mapping in u_upload_alloc()

Brian Paul brian.e.paul at gmail.com
Mon Oct 24 08:40:25 PDT 2011


From: Brian Paul <brianp at vmware.com>

---
 src/gallium/auxiliary/util/u_upload_mgr.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index aef4d40..a2319d0 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -187,6 +187,11 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
 					  PIPE_TRANSFER_FLUSH_EXPLICIT |
 					  PIPE_TRANSFER_UNSYNCHRONIZED,
 					  &upload->transfer);
+      if (!upload->map) {
+         pipe_resource_reference(outbuf, NULL);
+         *ptr = NULL;
+         return PIPE_ERROR_OUT_OF_MEMORY;
+      }
    }
 
    assert(offset < upload->buffer->width0);
-- 
1.7.3.4



More information about the mesa-dev mailing list