From 23fc2803839cfc3d27c7f0c31880b25a45947cab Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 16 Dec 2021 12:24:07 +0200 Subject: [PATCH] =?UTF-8?q?fix=20leak=20in=20=E2=80=A2file.List?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/file.c b/src/utils/file.c index 895932d2..607dcd6a 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -60,7 +60,7 @@ I8Arr* file_bytes(B path) { // consumes B file_chars(B path) { // consumes return fromUTF8a(file_bytes(path)); } -B file_lines(B path) { // consumes +B file_lines(B path) { // consumes; TODO rewrite this, it's horrible I8Arr* tf = file_bytes(path); usz ia = tf->ia; u8* p = (u8*)tf->a; usz lineCount = 0; @@ -202,6 +202,7 @@ B file_list(B path) { char* name = c->d_name; if (name[0]=='.'? !(name[1]==0 || (name[1]=='.'&&name[2]==0)) : true) res = vec_add(res, m_str8l(name)); } + closedir(d); dec(path); return res; }