diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-01-11 16:35:19 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-01-11 16:35:19 +0200 |
| commit | 67af2eead2b9424ba311ef208cd45df839c3efbe (patch) | |
| tree | 7eddfb0bf01c5b259f4d96e8630ec141005a965e /src/ast.c | |
| parent | 45b3531e29c1b596f1be123de94b7c618c92bf8a (diff) | |
| download | ek-67af2eead2b9424ba311ef208cd45df839c3efbe.tar.gz ek-67af2eead2b9424ba311ef208cd45df839c3efbe.zip | |
fix some analyzer warnings
Diffstat (limited to 'src/ast.c')
| -rw-r--r-- | src/ast.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -76,6 +76,9 @@ static struct ast *create_empty_ast() } struct ast *n = calloc(1, sizeof(struct ast)); + if (!n) + return NULL; + /* just to be safe */ n->k = AST_EMPTY; vect_append(struct ast *, nodes, &n); @@ -89,6 +92,9 @@ static struct type *create_empty_type() } struct type *n = calloc(1, sizeof(struct type)); + if (!n) + return NULL; + /* just to be safe */ n->k = TYPE_VOID; n->size = -1; @@ -393,6 +399,9 @@ struct ast *clone_ast(struct ast *n) assert(n->k); struct ast *new = create_empty_ast(); + if (!new) + return NULL; + new->scope = n->scope; new->loc = n->loc; new->k = n->k; @@ -435,6 +444,9 @@ struct type *clone_type(struct type *n) assert(n->k); struct type *new = create_empty_type(); + if (!new) + return NULL; + new->scope = n->scope; new->loc = n->loc; new->k = n->k; |
