From: Brian Paul Date: Mon, 24 Oct 2011 15:40:07 +0000 (-0600) Subject: util: handle failed mapping in u_upload_alloc() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9dc7df1feaa4f5d2f03a7490aafc6064e309f818;p=mesa.git util: handle failed mapping in u_upload_alloc() 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 aef4d409c2c..a2319d0c436 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);