mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
ast_instantiate should check return value of mem_a and return NULL on error
This commit is contained in:
parent
281bd8657a
commit
4c165cbd07
1 changed files with 3 additions and 0 deletions
3
ast.c
3
ast.c
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue