diff options
| author | LLLL Colonq <llll@colonq> | 2026-09-29 17:34:12 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-09-29 17:34:12 -0400 |
| commit | 84f13229756b5a9253d7013ede8ed3a602ee5376 (patch) | |
| tree | 618c88ed27e9e528a6eeb52935baa1d55be0ee5d /pit/src/native.c | |
| parent | 17df4b1ff7f4cbcf3b3218fea68f65d3cb60c984 (diff) | |
pit: Better double support
Diffstat (limited to 'pit/src/native.c')
| -rw-r--r-- | pit/src/native.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pit/src/native.c b/pit/src/native.c index 4dab09d..8ef886d 100644 --- a/pit/src/native.c +++ b/pit/src/native.c @@ -17,6 +17,7 @@ i64 pit_lex_file(pit_lexer *ret, char *path) { fseek(f, 0, SEEK_SET); char *buf = calloc((size_t) len, sizeof(char)); if ((size_t) len != fread(buf, sizeof(char), (size_t) len, f)) { + free(buf); fclose(f); return -1; } @@ -294,6 +295,7 @@ static pit_value impl_bs_new(pit_runtime *rt, pit_value args, void *data) { (void) args; i64 cap = 256; struct bytestring *bs = malloc(sizeof(struct bytestring)); + if (!bs) return PIT_NIL; bs->len = 0; bs->cap = cap; bs->data = calloc((size_t) cap, 1); |
