aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/link_atomics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl/link_atomics.cpp')
-rw-r--r--mesalib/src/glsl/link_atomics.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/mesalib/src/glsl/link_atomics.cpp b/mesalib/src/glsl/link_atomics.cpp
index d92cdb117..fbe4e7364 100644
--- a/mesalib/src/glsl/link_atomics.cpp
+++ b/mesalib/src/glsl/link_atomics.cpp
@@ -54,9 +54,18 @@ namespace {
void push_back(unsigned id, ir_variable *var)
{
- counters = (active_atomic_counter *)
- realloc(counters, sizeof(active_atomic_counter) * (num_counters + 1));
+ active_atomic_counter *new_counters;
+ new_counters = (active_atomic_counter *)
+ realloc(counters, sizeof(active_atomic_counter) *
+ (num_counters + 1));
+
+ if (new_counters == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
+ counters = new_counters;
counters[num_counters].id = id;
counters[num_counters].var = var;
num_counters++;