summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-12 01:20:33 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-12 01:20:33 -0500
commit018eeacaa4059df74e2745fcdadc2ad85afec985 (patch)
treef9887bc21ec91f7b6d2fa786a76d7c1d36e26ce7
parent0b07431aa3128e9cb903b933148f20353953c592 (diff)
downloaddimension-018eeacaa4059df74e2745fcdadc2ad85afec985.tar.xz
Don't leak a file handle on parse failures from within includes.
-rw-r--r--dimension/tokenize.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/dimension/tokenize.c b/dimension/tokenize.c
index e872e0c..33512ae 100644
--- a/dimension/tokenize.c
+++ b/dimension/tokenize.c
@@ -866,6 +866,11 @@ dmnsn_yylex_cleanup(void *yyscanner)
{
dmnsn_token_buffer *tbuffer = dmnsn_yyget_extra(yyscanner);
while (tbuffer) {
+ if (tbuffer->type == DMNSN_T_INCLUDE) {
+ dmnsn_yy_pop_buffer(yyscanner);
+ fclose(tbuffer->ptr);
+ }
+
dmnsn_token_buffer *prev = tbuffer->prev;
dmnsn_delete_token_buffer(tbuffer);
tbuffer = prev;