[Mesa-dev] [PATCH 9/9] util/disk_cache: remove null check before free

Nicolai Hähnle nhaehnle at gmail.com
Thu Apr 13 09:37:24 UTC 2017


Patches 8 & 9:

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 12.04.2017 00:04, Thomas Hindoe Paaboel Andersen wrote:
> ---
>  src/util/disk_cache.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index d9de8ef..93fb1f5 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -891,10 +891,8 @@ cache_put(void *job, int thread_index)
>      */
>     if (fd != -1)
>        close(fd);
> -   if (filename_tmp)
> -      free(filename_tmp);
> -   if (filename)
> -      free(filename);
> +   free(filename_tmp);
> +   free(filename);
>  }
>
>  void
> @@ -1036,12 +1034,9 @@ disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size)
>     return uncompressed_data;
>
>   fail:
> -   if (data)
> -      free(data);
> -   if (uncompressed_data)
> -      free(uncompressed_data);
> -   if (filename)
> -      free(filename);
> +   free(data);
> +   free(uncompressed_data);
> +   free(filename);
>     if (fd != -1)
>        close(fd);
>
>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list