From: Paul Berry Date: Wed, 31 Jul 2013 05:38:43 +0000 (-0700) Subject: glsl/linker: Make separate allocations to track vertex and fragment shaders. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=844bd71736dd59808e1ea4319800db042a7c4267;p=mesa.git glsl/linker: Make separate allocations to track vertex and fragment shaders. There's no reason to be clever about this. By making separate allocations for vertex and fragment shaders, we'll allow geometry shaders to be added without introducing any complication. Reviewed-by: Kenneth Graunke --- diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 7fae0b8c47d..d7ea740dbf0 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1615,8 +1615,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) unsigned num_frag_shaders = 0; vert_shader_list = (struct gl_shader **) - calloc(2 * prog->NumShaders, sizeof(struct gl_shader *)); - frag_shader_list = &vert_shader_list[prog->NumShaders]; + calloc(prog->NumShaders, sizeof(struct gl_shader *)); + frag_shader_list = (struct gl_shader **) + calloc(prog->NumShaders, sizeof(struct gl_shader *)); unsigned min_version = UINT_MAX; unsigned max_version = 0; @@ -1948,6 +1949,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) done: free(vert_shader_list); + free(frag_shader_list); for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { if (prog->_LinkedShaders[i] == NULL)