[Mesa-dev] [PATCH] radv: fix memory leaks in radv_load_meta_pipeline()

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Wed Aug 15 13:44:14 UTC 2018


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Wed, Aug 15, 2018 at 3:28 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Reported by Coverity.
>
> Fixes: fbcd167314 ("radv: Add on-demand compilation of built-in shaders.")
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_meta.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
> index ccdcb9ceb0..b8d0a7cfc7 100644
> --- a/src/amd/vulkan/radv_meta.c
> +++ b/src/amd/vulkan/radv_meta.c
> @@ -263,6 +263,7 @@ radv_load_meta_pipeline(struct radv_device *device)
>         char path[PATH_MAX + 1];
>         struct stat st;
>         void *data = NULL;
> +       bool ret = false;
>
>         if (!radv_builtin_cache_path(path))
>                 return false;
> @@ -278,11 +279,11 @@ radv_load_meta_pipeline(struct radv_device *device)
>         if(read(fd, data, st.st_size) == -1)
>                 goto fail;
>
> -       return radv_pipeline_cache_load(&device->meta_state.cache, data, st.st_size);
> +       ret = radv_pipeline_cache_load(&device->meta_state.cache, data, st.st_size);
>  fail:
>         free(data);
>         close(fd);
> -       return false;
> +       return ret;
>  }
>
>  static void
> --
> 2.18.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list