aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2013-01-28 02:47:24 +0100
committerAndreas Boll <andreas.boll.dev@gmail.com>2013-02-13 21:48:36 +0100
commitd40df8073209e54c943d3ecaa20cf3297a765907 (patch)
tree71a9f4cb80423b0e2d2b0cc5f1e525f0f248514f
parent914368538ec72926f160e784dcbae5db05e34abe (diff)
downloadmesa3d-d40df8073209e54c943d3ecaa20cf3297a765907.tar.gz
gallium/u_upload_mgr: fix a serious memory leak
It can eat all memory and crash in a matter of minutes with r600g. (cherry picked from commit 87592cff57feef29565150b9203e220b50623f30)
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 21d4bca4b9d..cb42e981fc8 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -168,7 +168,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
* sure the caller doesn't get garbage values.
*/
*out_offset = ~0;
- *outbuf = NULL;
+ pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
/* Make sure we have enough space in the upload buffer
@@ -190,7 +190,6 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
PIPE_TRANSFER_UNSYNCHRONIZED,
&upload->transfer);
if (!upload->map) {
- pipe_resource_reference(outbuf, NULL);
upload->transfer = NULL;
return PIPE_ERROR_OUT_OF_MEMORY;
}