From: Brian Paul Date: Mon, 24 Oct 2011 15:37:26 +0000 (-0600) Subject: util: handle failed mapping in u_upload_alloc_buffer() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19961da4cb115ca930186bef41fb92740fdd09d1;p=mesa.git util: handle failed mapping in u_upload_alloc_buffer() Reviewed-by: José Fonseca --- 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;