[Mesa-dev] [PATCH 2/2] glsl: Check for null pointer at ir_variable_refcount_visitor()
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Wed Feb 3 08:56:52 UTC 2016
Look after calloc give memory address.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
src/compiler/glsl/ir_variable_refcount.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/compiler/glsl/ir_variable_refcount.cpp b/src/compiler/glsl/ir_variable_refcount.cpp
index 8306be1..942ef25 100644
--- a/src/compiler/glsl/ir_variable_refcount.cpp
+++ b/src/compiler/glsl/ir_variable_refcount.cpp
@@ -34,6 +34,7 @@
#include "ir_variable_refcount.h"
#include "compiler/glsl_types.h"
#include "util/hash_table.h"
+#include "main/errors.h"
ir_variable_refcount_visitor::ir_variable_refcount_visitor()
{
@@ -144,6 +145,12 @@ ir_variable_refcount_visitor::visit_leave(ir_assignment *ir)
if (entry->referenced_count == entry->assigned_count) {
struct assignment_entry *assignment_entry =
(struct assignment_entry *)calloc(1, sizeof(*assignment_entry));
+
+ if (!assignment_entry) {
+ _mesa_error_no_memory(__func__);
+ return visit_stop;
+ }
+
assignment_entry->assign = ir;
entry->assign_list.push_head(&assignment_entry->link);
}
--
1.9.1
More information about the mesa-dev
mailing list