Mesa (mesa_7_5_branch): util: Reset size to zero when failed to allocate buffer.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Fri Aug 28 11:53:08 UTC 2009
Module: Mesa
Branch: mesa_7_5_branch
Commit: 9399b9a0e27915dd5a388ff42ad99a9024c79b33
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9399b9a0e27915dd5a388ff42ad99a9024c79b33
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Aug 28 12:52:16 2009 +0100
util: Reset size to zero when failed to allocate buffer.
---
src/gallium/auxiliary/util/u_upload_mgr.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index c90425f..eb635c9 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -123,21 +123,25 @@ static enum pipe_error
u_upload_alloc_buffer( struct u_upload_mgr *upload,
unsigned min_size )
{
+ unsigned size;
+
/* Release old buffer, if present:
*/
u_upload_flush( upload );
/* Allocate a new one:
*/
- upload->size = align(MAX2(upload->default_size, min_size), 4096);
+ size = align(MAX2(upload->default_size, min_size), 4096);
upload->buffer = pipe_buffer_create( upload->screen,
upload->alignment,
upload->usage | PIPE_BUFFER_USAGE_CPU_WRITE,
- upload->size );
+ size );
if (upload->buffer == NULL)
goto fail;
+ upload->size = size;
+
upload->offset = 0;
return 0;
More information about the mesa-commit
mailing list