[Mesa-dev] [PATCH 1/2] glsl/shader_cache: Fix memory leak

Grazvydas Ignotas notasas at gmail.com
Sun Apr 2 20:01:37 UTC 2017


On Sun, Apr 2, 2017 at 8:31 PM, Bartosz Tomczyk <bartosz.tomczyk86 at gmail.com
> wrote:

> ---
>  src/compiler/glsl/shader_cache.cpp | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/compiler/glsl/shader_cache.cpp
> b/src/compiler/glsl/shader_cache.cpp
> index ea1bc01f02..8c42a95664 100644
> --- a/src/compiler/glsl/shader_cache.cpp
> +++ b/src/compiler/glsl/shader_cache.cpp
> @@ -1273,6 +1273,8 @@ shader_cache_write_program_metadata(struct
> gl_context *ctx,
>
>     disk_cache_put(cache, prog->data->sha1, metadata->data,
> metadata->size);
>
> +   if(metadata->data)
> +      free(metadata->data);
>

Please add a space after 'if' to match the style of all other code or drop
the NULL check altogether as free(NULL) is fine. With that:
Reviewed-by: Grazvydas Ignotas <notasas at gmail.com>
for both patches.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170402/36b5d304/attachment-0001.html>


More information about the mesa-dev mailing list