Workaround for memory leak in flex.
[gedcom-parse.git] / gedcom / gedcom_hilo.lex
index 60b7a1a280bd41f4eea0ab9c026109251ab1045a..a5216bb7561343014e8a648a81844722c27c411a 100644 (file)
@@ -40,6 +40,7 @@ delim        \x00\x20
 tab          \x00[\t]
 hash         \x00#
 literal_at   \x00@\x00@
+normal_at    \x00@
 otherchar    \x00[\x21-\x22\x24-\x2F\x3A-\x3F\x5B-\x5E\x60\x7B-\x7E\x80-\xFF]|[\x01-\xFF][\x00-\xFF]
 terminator   \x00\x0D|\x00\x0A|\x00\x0D\x00\x0A|\x00\x0A\x00\x0D
 
@@ -212,12 +213,18 @@ ACTION_BEFORE_REGEXPS
 
 <<EOF>>                  ACTION_EOF
 
+{normal_at}              ACTION_NORMAL_AT
+
 .                        ACTION_UNEXPECTED
 
 %%
 
+static int exitfuncregistered = 0;
+
 int yywrap()
 {
+  if (! exitfuncregistered && atexit(yylex_cleanup) == 0)
+    atexit(yylex_cleanup);
   return 1;
 }