summaryrefslogtreecommitdiffstats
path: root/dimension/tokenize.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-09 21:41:44 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-09 21:41:44 -0500
commit4542f7a7449b4a6c8273ae15d6e854ead0dfe13a (patch)
treecf144f609a67bd3dc73c0dd30332e592f786f1e2 /dimension/tokenize.c
parent7d3a45468b07356d6ca2863b59163b165a83a0f0 (diff)
downloaddimension-4542f7a7449b4a6c8273ae15d6e854ead0dfe13a.tar.xz
Don't leak memory on parse failures from within buffers.
Diffstat (limited to 'dimension/tokenize.c')
-rw-r--r--dimension/tokenize.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dimension/tokenize.c b/dimension/tokenize.c
index 8d85b2d..7269fb4 100644
--- a/dimension/tokenize.c
+++ b/dimension/tokenize.c
@@ -788,3 +788,15 @@ dmnsn_yylex(dmnsn_parse_item *lvalp, dmnsn_parse_location *llocp,
}
}
}
+
+void
+dmnsn_yylex_cleanup(void *yyscanner)
+{
+ dmnsn_token_buffer *tbuffer = dmnsn_yyget_extra(yyscanner);
+ while (tbuffer) {
+ dmnsn_token_buffer *prev = tbuffer->prev;
+ dmnsn_delete_token_buffer(tbuffer);
+ tbuffer = prev;
+ }
+ dmnsn_yyset_extra(NULL, yyscanner);
+}