Mesa (master): util: handle failed mapping in u_upload_alloc_buffer()

Brian Paul brianp at kemper.freedesktop.org
Mon Oct 24 15:43:56 PDT 2011


Module: Mesa
Branch: master
Commit: 19961da4cb115ca930186bef41fb92740fdd09d1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=19961da4cb115ca930186bef41fb92740fdd09d1

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Oct 24 09:37:26 2011 -0600

util: handle failed mapping in u_upload_alloc_buffer()

Reviewed-by: José Fonseca <jfonseca 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;



More information about the mesa-commit mailing list