diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-17 20:47:33 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-17 20:47:33 +0300 |
| commit | 395efb9c8a0a0160a7b95769e9484bae5548bbde (patch) | |
| tree | a5b4dc24dd3a2097d055b66b0cde8e23832802eb /src/compiler.c | |
| parent | 2023a7b2d9656f80b00de81453348c0a66f200f7 (diff) | |
| download | ek-395efb9c8a0a0160a7b95769e9484bae5548bbde.tar.gz ek-395efb9c8a0a0160a7b95769e9484bae5548bbde.zip | |
add analyzer and fix some reported issues
Diffstat (limited to 'src/compiler.c')
| -rw-r--r-- | src/compiler.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler.c b/src/compiler.c index 14a838a..c29f6c7 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -82,21 +82,28 @@ static int process(struct scope **parent, int public, const char *file) return -1; struct parser *p = create_parser(); - if (!p) + if (!p) { + free((void *)buf); return -1; + } + parse(p, file, buf); struct ast *tree = p->tree; bool failed = p->failed; destroy_parser(p); - if (failed) + if (failed) { + free((void*)buf); return -1; + } ast_dump_list(0, tree); struct scope *scope = create_scope(); - if (!scope) + if (!scope) { + free((void *)buf); return -1; + } if (public) scope_set_flags(scope, SCOPE_PUBLIC); |
