summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/nir/nir_worklist.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_worklist.h b/src/compiler/nir/nir_worklist.h
index e3769087664..3fb391fceff 100644
--- a/src/compiler/nir/nir_worklist.h
+++ b/src/compiler/nir/nir_worklist.h
@@ -105,8 +105,15 @@ typedef struct {
static inline nir_instr_worklist *
nir_instr_worklist_create() {
nir_instr_worklist *wl = malloc(sizeof(nir_instr_worklist));
- u_vector_init(&wl->instr_vec, sizeof(struct nir_instr *),
- sizeof(struct nir_instr *) * 8);
+ if (!wl)
+ return NULL;
+
+ if (!u_vector_init(&wl->instr_vec, sizeof(struct nir_instr *),
+ sizeof(struct nir_instr *) * 8)) {
+ free(wl);
+ return NULL;
+ }
+
return wl;
}