]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
ast_instantiate should check return value of mem_a and return NULL on error
authorWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 13:09:17 +0000 (15:09 +0200)
committerWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 13:09:17 +0000 (15:09 +0200)
ast.c

diff --git a/ast.c b/ast.c
index 0fe0362cc4901f56dd490a78aebe447fd22935db..3595524c83d8f7af39b1856e793c9608af5a50cb 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -29,6 +29,9 @@
 
 #define ast_instantiate(T, ctx, destroyfn)                          \
     T* self = (T*)mem_a(sizeof(T));                                 \
+    if (!self) {                                                    \
+        return NULL;                                                \
+    }                                                               \
     ast_node_init((ast_node*)self, ctx);                            \
     ( (ast_node*)self )->node.destroy = (ast_node_delete*)destroyfn