From d33ea41645432eb194ae1366247e337a7454f799 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 12 Oct 2025 14:22:50 -0400 Subject: Fix memory leaks --- src/stdlib/files.c | 1 + src/stdlib/paths.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/stdlib/files.c b/src/stdlib/files.c index 88d78676..b0545420 100644 --- a/src/stdlib/files.c +++ b/src/stdlib/files.c @@ -116,6 +116,7 @@ static file_t *_load_file(const char *filename, FILE *file) { ret->relative_filename = &filename[cwd_len + 1]; } } + if (line_buf != NULL) free(line_buf); return ret; } diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c index 73f62975..810f98b1 100644 --- a/src/stdlib/paths.c +++ b/src/stdlib/paths.c @@ -662,6 +662,7 @@ static Text_t _next_line(FILE **f) { next_line:; ssize_t len = getline(&line, &size, *f); if (len <= 0) { + if (line != NULL) free(line); _line_reader_cleanup(f); return NONE_TEXT; } -- cgit v1.2.3