X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=ast.c;h=2b4a456ebb08e5e388d79bbe9a910d49c51d1a9e;hb=10c7f4f838dc976470d3308c5a5910dc7cba41b0;hp=7d4b93dd28aa1c4acf254cbbe035491644a4a83e;hpb=e146fd121caad020e2f5259ed71dc3146c2dafb1;p=xonotic%2Fgmqcc.git diff --git a/ast.c b/ast.c index 7d4b93d..2b4a456 100644 --- a/ast.c +++ b/ast.c @@ -724,9 +724,12 @@ ast_ternary* ast_ternary_new(lex_ctx ctx, ast_expression *cond, ast_expression * void ast_ternary_delete(ast_ternary *self) { - ast_unref(self->cond); - ast_unref(self->on_true); - ast_unref(self->on_false); + /* the if()s are only there because computed-gotos can set them + * to NULL + */ + if (self->cond) ast_unref(self->cond); + if (self->on_true) ast_unref(self->on_true); + if (self->on_false) ast_unref(self->on_false); ast_expression_delete((ast_expression*)self); mem_d(self); } @@ -831,6 +834,8 @@ ast_label* ast_label_new(lex_ctx ctx, const char *name, bool undefined) ast_instantiate(ast_label, ctx, ast_label_delete); ast_expression_init((ast_expression*)self, (ast_expression_codegen*)&ast_label_codegen); + self->expression.vtype = TYPE_NOEXPR; + self->name = util_strdup(name); self->irblock = NULL; self->gotos = NULL;