util: handle failed mapping in u_upload_alloc_buffer()

Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
Brian Paul
2011-10-24 09:37:26 -06:00
parent 4e6a0b40c5
commit 19961da4cb
+6 -1
View File
@@ -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;