[Mesa-dev] [PATCH 06/15] glsl: add missing null check in tfeedback_decl::init()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Sun Apr 27 13:05:01 PDT 2014


Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/glsl/link_varyings.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index c925c00..c3cc509 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -278,6 +278,11 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx,
    const char *base_name_end;
    long subscript = parse_program_resource_name(input, &base_name_end);
    this->var_name = ralloc_strndup(mem_ctx, input, base_name_end - input);
+   if (this->var_name == NULL) {
+      _mesa_error_no_memory(__func__);
+      return;
+   }
+
    if (subscript >= 0) {
       this->array_subscript = subscript;
       this->is_subscripted = true;
-- 
1.8.1.2



More information about the mesa-dev mailing list