diff --git a/src/program.c b/src/program.c
index c2bd51f7ec3b17dc260d4e24fd32044201ef94a7..274f1e34a344ad1012fb2877674ea7e24a54480f 100644
--- a/src/program.c
+++ b/src/program.c
@@ -493,6 +493,12 @@ struct program *end_program()
     free((char *)local_variables);
     local_variables=l;
   }
+  
+  if(last_file)
+  {
+    free_string(last_file);
+    last_file=0;
+  }
 
 #define PROGRAM_STATE
 #define POP