diff options
author | David Phillips <david@sighup.nz> | 2019-08-11 17:22:20 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2019-08-11 17:22:20 +1200 |
commit | 2d2628df0001d2b643811dc69717c4afe70c4e31 (patch) | |
tree | f5d0da23c47c3e677ca423a91838c5ad5467a5d9 /assembler.c | |
parent | 0e6f47211a0516cf2c96d2b9e89c0d841978c143 (diff) | |
download | toy-cpu-assembler-2d2628df0001d2b643811dc69717c4afe70c4e31.tar.xz |
Fix and add tests for NULL deref cases found by scan-build
Diffstat (limited to 'assembler.c')
-rw-r--r-- | assembler.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/assembler.c b/assembler.c index bd94c33..bc6d7dd 100644 --- a/assembler.c +++ b/assembler.c @@ -63,8 +63,6 @@ int main(int argc, char **argv) if ((tokens = lex(path_in, fin, &tok_count)) == NULL) return error_ret; - - fclose(fin); debug("Lexed.\n"); /* FIXME package these things into `tok_result`, `parse_result` etc */ @@ -86,6 +84,7 @@ int main(int argc, char **argv) parse_free(insts, insts_count, labels, labels_count); lex_free(tokens, tok_count); + fclose(fin); fclose(fout); debug("Output.\n"); |