glsl: Initialize glsl_type member name.
authorVinson Lee <vlee@freedesktop.org>
Wed, 25 Nov 2020 02:51:10 +0000 (18:51 -0800)
committerVinson Lee <vlee@freedesktop.org>
Thu, 17 Dec 2020 03:31:25 +0000 (19:31 -0800)
Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member name is not initialized in
this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7766>

src/compiler/glsl_types.cpp

index f5cc1742c1753ffaf43018dff367b4fd28d1aeb6..98d962481e10c8ec10819d39e6f77b5fecfaac1d 100644 (file)
@@ -175,6 +175,8 @@ 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->fields.parameters = rzalloc_array(this->mem_ctx,
                                            glsl_function_param, num_params + 1);