]> Nishi Git Mirror - gwion.git/commitdiff
:bomb: Fix compile file leak
authorfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 9 Oct 2019 18:50:02 +0000 (20:50 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 9 Oct 2019 18:50:02 +0000 (20:50 +0200)
src/compile.c

index 04615afefb360b281fc095b9db5ff50ef23d0b8d..991761f1b16dbaad729da82d4ab844af96ad8901 100644 (file)
@@ -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);