util: handle failed mapping in u_upload_alloc()
authorBrian Paul <brianp@vmware.com>
Mon, 24 Oct 2011 15:40:07 +0000 (09:40 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 24 Oct 2011 22:39:58 +0000 (16:39 -0600)
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_upload_mgr.c

index aef4d409c2cc67b0f662deb01f5c421e1f410491..a2319d0c4361942e39c08ee4a0fbc11f5f9c0be0 100644 (file)
@@ -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);