ast_instantiate should check return value of mem_a and return NULL on error

This commit is contained in:
Wolfgang Bumiller 2012-05-01 15:09:17 +02:00
parent 281bd8657a
commit 4c165cbd07

3
ast.c
View file

@ -29,6 +29,9 @@
#define ast_instantiate(T, ctx, destroyfn) \ #define ast_instantiate(T, ctx, destroyfn) \
T* self = (T*)mem_a(sizeof(T)); \ T* self = (T*)mem_a(sizeof(T)); \
if (!self) { \
return NULL; \
} \
ast_node_init((ast_node*)self, ctx); \ ast_node_init((ast_node*)self, ctx); \
( (ast_node*)self )->node.destroy = (ast_node_delete*)destroyfn ( (ast_node*)self )->node.destroy = (ast_node_delete*)destroyfn