[Mesa-dev] [PATCH] anv/batch_chain: free pointers for error cases

Jason Ekstrand jason at jlekstrand.net
Wed May 18 21:58:47 UTC 2016


R-B

On Wed, May 18, 2016 at 2:37 PM, Mark Janes <mark.a.janes at intel.com> wrote:

> Trivial fix to improperly handled cleanup during
> VK_ERROR_OUT_OF_HOST_MEMORY.
>
> Identified by Coverity: CID 1358908 and 1358909
> ---
>  src/intel/vulkan/anv_batch_chain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_batch_chain.c
> b/src/intel/vulkan/anv_batch_chain.c
> index 36c9565..a98a0a9 100644
> --- a/src/intel/vulkan/anv_batch_chain.c
> +++ b/src/intel/vulkan/anv_batch_chain.c
> @@ -120,7 +120,7 @@ anv_reloc_list_grow(struct anv_reloc_list *list,
>     struct anv_bo **new_reloc_bos =
>        anv_alloc(alloc, new_length * sizeof(*list->reloc_bos), 8,
>                  VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> -   if (new_relocs == NULL) {
> +   if (new_reloc_bos == NULL) {
>        anv_free(alloc, new_relocs);
>        return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
>     }
> @@ -891,7 +891,7 @@ anv_cmd_buffer_add_bo(struct anv_cmd_buffer
> *cmd_buffer,
>           struct anv_bo **new_bos =
>              anv_alloc(&cmd_buffer->pool->alloc, new_len *
> sizeof(*new_bos),
>                        8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> -         if (new_objects == NULL) {
> +         if (new_bos == NULL) {
>              anv_free(&cmd_buffer->pool->alloc, new_objects);
>              return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
>           }
> --
> 2.8.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160518/e53cd92b/attachment.html>


More information about the mesa-dev mailing list