mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-20 18:32:01 +00:00
fixing a possible NULL deref
This commit is contained in:
parent
e311dffcb3
commit
00a9d2a9e3
2 changed files with 6 additions and 3 deletions
5
ast.c
5
ast.c
|
@ -890,6 +890,11 @@ ast_call* ast_call_new(lex_ctx ctx,
|
|||
ast_expression *funcexpr)
|
||||
{
|
||||
ast_instantiate(ast_call, ctx, ast_call_delete);
|
||||
if (!funcexpr->expression.next) {
|
||||
compile_error(ctx, "not a function");
|
||||
mem_d(self);
|
||||
return NULL;
|
||||
}
|
||||
ast_expression_init((ast_expression*)self, (ast_expression_codegen*)&ast_call_codegen);
|
||||
|
||||
ast_side_effects(self) = true;
|
||||
|
|
4
parser.c
4
parser.c
|
@ -1417,10 +1417,8 @@ static bool parser_close_call(parser_t *parser, shunt *sy)
|
|||
}
|
||||
|
||||
call = ast_call_new(sy->ops[vec_size(sy->ops)].ctx, fun);
|
||||
if (!call) {
|
||||
parseerror(parser, "internal error: failed to create ast_call node");
|
||||
if (!call)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fid+1 == vec_size(sy->out)) {
|
||||
/* no arguments */
|
||||
|
|
Loading…
Reference in a new issue