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

Thomas Hindoe Paaboel Andersen phomes at gmail.com
Tue Apr 11 22:04:07 UTC 2017


---
 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);
 
-- 
2.9.3



More information about the mesa-dev mailing list