[Mesa-dev] [PATCH 6/9] radv: remove null check before free

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


---
 src/amd/vulkan/radv_pipeline.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index cf11362..e3eacf3 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -585,8 +585,7 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
 		variant = radv_pipeline_cache_insert_shader(cache, sha1, variant,
 							    code, code_size);
 
-	if (code)
-		free(code);
+	free(code);
 	return variant;
 }
 
@@ -706,10 +705,8 @@ radv_tess_pipeline_compile(struct radv_pipeline *pipeline,
 		tcs_variant = radv_pipeline_cache_insert_shader(cache, tcs_sha1, tcs_variant,
 								tcs_code, tcs_code_size);
 
-	if (tes_code)
-		free(tes_code);
-	if (tcs_code)
-		free(tcs_code);
+	free(tes_code);
+	free(tcs_code);
 	pipeline->shaders[MESA_SHADER_TESS_CTRL] = tcs_variant;
 	pipeline->shaders[MESA_SHADER_TESS_EVAL] = tes_variant;
 	return;
-- 
2.9.3



More information about the mesa-dev mailing list