From 19961da4cb115ca930186bef41fb92740fdd09d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 24 Oct 2011 09:37:26 -0600 Subject: [PATCH] util: handle failed mapping in u_upload_alloc_buffer() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: José Fonseca --- src/gallium/auxiliary/util/u_upload_mgr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.7.4