[Mesa-dev] [PATCH 14/20] glsl: Check calloc return value in link_intrastage_shaders()
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Wed May 14 10:56:00 PDT 2014
Check calloc return value while adding build-in functions.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
src/glsl/linker.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index a43d230..97bd0ef 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1590,6 +1590,12 @@ link_intrastage_shaders(void *mem_ctx,
*/
gl_shader **linking_shaders = (gl_shader **)
calloc(num_shaders + 1, sizeof(gl_shader *));
+
+ if (linking_shaders == NULL) {
+ _mesa_error_no_memory(__func__);
+ ctx->Driver.DeleteShader(ctx, linked);
+ return NULL;
+ }
memcpy(linking_shaders, shader_list, num_shaders * sizeof(gl_shader *));
linking_shaders[num_shaders] = _mesa_glsl_get_builtin_function_shader();
--
1.8.1.2
More information about the mesa-dev
mailing list