radv: fix memory leaks in radv_load_meta_pipeline()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 15 Aug 2018 13:28:43 +0000 (15:28 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 15 Aug 2018 14:20:58 +0000 (16:20 +0200)
Reported by Coverity.

Fixes: fbcd167314 ("radv: Add on-demand compilation of built-in shaders.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta.c

index ccdcb9ceb078c04852074c4c23ab59875cd0f8b0..b8d0a7cfc705b563c64ac5b5f1c96b5e66d5f958 100644 (file)
@@ -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