summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <[email protected]>2014-06-27 16:16:20 +0300
committerTapani Pälli <[email protected]>2014-09-23 10:25:02 +0300
commita3d6146e3a772059bfb68d5d041df2b96c4cc444 (patch)
tree48e25d1415bbf4cf5f7a4cde3ceb7433b6ccdddf /src/glsl
parent261120daefbf3681394c52928e19f901a5f46d61 (diff)
glsl: Check realloc return value in ir_function::matching_signature()
Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_function.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp
index 98bec45ceec..2b2643c64a2 100644
--- a/src/glsl/ir_function.cpp
+++ b/src/glsl/ir_function.cpp
@@ -24,6 +24,7 @@
#include "glsl_types.h"
#include "ir.h"
#include "glsl_parser_extras.h"
+#include "main/errors.h"
typedef enum {
PARAMETER_LIST_NO_MATCH,
@@ -296,6 +297,7 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state,
bool *is_exact)
{
ir_function_signature **inexact_matches = NULL;
+ ir_function_signature **inexact_matches_temp;
ir_function_signature *match = NULL;
int num_inexact_matches = 0;
@@ -321,11 +323,16 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state,
free(inexact_matches);
return sig;
case PARAMETER_LIST_INEXACT_MATCH:
- inexact_matches = (ir_function_signature **)
+ inexact_matches_temp = (ir_function_signature **)
realloc(inexact_matches,
sizeof(*inexact_matches) *
(num_inexact_matches + 1));
- assert(inexact_matches);
+ if (inexact_matches_temp == NULL) {
+ _mesa_error_no_memory(__func__);
+ free(inexact_matches);
+ return NULL;
+ }
+ inexact_matches = inexact_matches_temp;
inexact_matches[num_inexact_matches++] = sig;
continue;
case PARAMETER_LIST_NO_MATCH: