[Mesa-dev] [PATCH] anv/cmd_buffer: fix host memory leak

Jason Ekstrand jason at jlekstrand.net
Wed Mar 29 21:33:59 UTC 2017


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

And pushed.

On Wed, Mar 29, 2017 at 12:14 PM, <cstout at chromium.org> wrote:

> From: Craig Stout <cstout at google.com>
>
> push_constants must be free'd.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=100452
> ---
>  src/intel/vulkan/anv_cmd_buffer.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_
> buffer.c
> index 909bee2..c65eba2 100644
> --- a/src/intel/vulkan/anv_cmd_buffer.c
> +++ b/src/intel/vulkan/anv_cmd_buffer.c
> @@ -120,7 +120,12 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer)
>     cmd_buffer->batch.status = VK_SUCCESS;
>
>     memset(&state->descriptors, 0, sizeof(state->descriptors));
> -   memset(&state->push_constants, 0, sizeof(state->push_constants));
> +   for (uint32_t i = 0; i < MESA_SHADER_STAGES; i++) {
> +      if (state->push_constants[i] != NULL) {
> +         vk_free(&cmd_buffer->pool->alloc, state->push_constants[i]);
> +         state->push_constants[i] = NULL;
> +      }
> +   }
>     memset(state->binding_tables, 0, sizeof(state->binding_tables));
>     memset(state->samplers, 0, sizeof(state->samplers));
>
> @@ -193,6 +198,9 @@ static VkResult anv_create_cmd_buffer(
>
>     cmd_buffer->batch.status = VK_SUCCESS;
>
> +   for (uint32_t i = 0; i < MESA_SHADER_STAGES; i++) {
> +      cmd_buffer->state.push_constants[i] = NULL;
> +   }
>     cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
>     cmd_buffer->device = device;
>     cmd_buffer->pool = pool;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170329/c1f6a709/attachment.html>


More information about the mesa-dev mailing list