From 412fe99ea6c59bbbaf68a8f3df208420e4e57eb2 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Fri, 1 Sep 2023 00:16:04 -0700 Subject: [PATCH] compiler/types: Don't duplicate empty string We can use the static version of the empty string. There's no worry about freeing that string incorrectly since what is being deallocated later is the whole mem_ctx. Reviewed-by: Emma Anholt Part-of: --- src/compiler/glsl_types.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index d04fbd360b0..7172ca146ce 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -178,7 +178,7 @@ glsl_type::glsl_type(const glsl_type *return_type, this->mem_ctx = ralloc_context(NULL); assert(this->mem_ctx != NULL); - this->name = ralloc_strdup(this->mem_ctx, ""); + this->name = ""; this->fields.parameters = rzalloc_array(this->mem_ctx, glsl_function_param, num_params + 1);