[Mesa-dev] [PATCH 06/11] glsl: check _mesa_hash_table_create return value in link_uniform_blocks

Ian Romanick idr at freedesktop.org
Fri Jun 20 16:53:05 PDT 2014


Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 06/19/2014 05:24 AM, Juha-Pekka Heikkila wrote:
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/glsl/link_uniform_blocks.cpp | 6 ++++++
>  src/glsl/linker.cpp              | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp
> index 1a0e643..53a18c93 100644
> --- a/src/glsl/link_uniform_blocks.cpp
> +++ b/src/glsl/link_uniform_blocks.cpp
> @@ -170,6 +170,12 @@ link_uniform_blocks(void *mem_ctx,
>     struct hash_table *block_hash =
>        _mesa_hash_table_create(mem_ctx, _mesa_key_string_equal);
>  
> +   if (block_hash == NULL) {
> +      _mesa_error_no_memory(__func__);
> +      linker_error(prog, "out of memory\n");
> +      return 0;
> +   }
> +
>     /* Determine which uniform blocks are active.
>      */
>     link_uniform_block_active_visitor v(mem_ctx, block_hash, prog);
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 0b6a716..247c828 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -1479,6 +1479,8 @@ link_intrastage_shaders(void *mem_ctx,
>     const unsigned num_uniform_blocks =
>        link_uniform_blocks(mem_ctx, prog, shader_list, num_shaders,
>                            &uniform_blocks);
> +   if (!prog->LinkStatus)
> +      return NULL;
>  
>     /* Check that there is only a single definition of each function signature
>      * across all shaders.
> 



More information about the mesa-dev mailing list