From faeb03078c82e97c570336e7f48093a160f4e884 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Wed, 9 Oct 2019 20:50:02 +0200 Subject: [PATCH] :bomb: Fix compile file leak --- src/compile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compile.c b/src/compile.c index 04615afe..991761f1 100644 --- a/src/compile.c +++ b/src/compile.c @@ -53,7 +53,8 @@ static inline void compiler_error(MemPool p, const struct Compiler* c) { static void compiler_clean(MemPool p, const struct Compiler* c) { if(c->name) xfree(c->name); - if(c->type == COMPILE_MSTR && c->file) + /* test c->type because COMPILE_FILE does not own file */ + if(c->type != COMPILE_FILE && c->file) fclose(c->file); if(c->ast) free_ast(p, c->ast); -- 2.43.0