glsl: check _mesa_hash_table_create return value in link_uniform_blocks
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Thu, 3 Apr 2014 14:06:42 +0000 (17:06 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 26 Jun 2014 12:37:14 +0000 (15:37 +0300)
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/link_uniform_blocks.cpp
src/glsl/linker.cpp

index 1a0e6431805e9c26a13992cc10e25f21be2c6039..53a18c934648b2ab6b0ddf28b26b5ce8488050bd 100644 (file)
@@ -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);
index 0b6a71679a71af3362c9552a7101e0ce3f69a9a1..247c828d3d695a78d9f0de0daf0a293fd84f963b 100644 (file)
@@ -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.