diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2020-08-25 09:39:06 -0400 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2020-09-24 15:17:57 -0700 |
commit | a2f1b6d268bc2afca357a6bf3c9aebc763840f46 (patch) | |
tree | 5e836ddad8de09de1fe14c7b97c5faecedac654f | |
parent | 01285ded24ebbd6d8c0ede6a97c6cf7a6dcdcd02 (diff) | |
download | mesa-a2f1b6d268bc2afca357a6bf3c9aebc763840f46.tar.gz |
zink: reorder create_stream_output_target to fix failure case leak
the previous version of this leaked a reference to the streamout buffer here
thanks to deltragon on my blog for pointing this out!
Fixes: 37778fcd9a35 ("zink: implement transform feedback support to finish off opengl 3.0")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6457>
(cherry picked from commit 7971918924dd84c2f33a5b7f0a8bf0c23ed994d8)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_context.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/.pick_status.json b/.pick_status.json index 0a8f1ba422d..809f5ee3f32 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -13,7 +13,7 @@ "description": "zink: reorder create_stream_output_target to fix failure case leak", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "37778fcd9a352430af0cd3b28a8776479a7c8380" }, diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 792027ceb93..935c2cadf33 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1048,12 +1048,6 @@ zink_create_stream_output_target(struct pipe_context *pctx, if (!t) return NULL; - t->base.reference.count = 1; - t->base.context = pctx; - pipe_resource_reference(&t->base.buffer, pres); - t->base.buffer_offset = buffer_offset; - t->base.buffer_size = buffer_size; - /* using PIPE_BIND_CUSTOM here lets us create a custom pipe buffer resource, * which allows us to differentiate and use VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT * as we must for this case @@ -1064,6 +1058,12 @@ zink_create_stream_output_target(struct pipe_context *pctx, return NULL; } + t->base.reference.count = 1; + t->base.context = pctx; + pipe_resource_reference(&t->base.buffer, pres); + t->base.buffer_offset = buffer_offset; + t->base.buffer_size = buffer_size; + return &t->base; } |