lexer: Fix memory leak merging tokens only some of which come from macros.
[pspp] / src / language / lexer / lexer.c
index 9a7d3ce1300c69853e3766aabc68888c56dda520..2218caadd7e4c525453b3d3d855bc0f0daf5a377 100644 (file)
@@ -1997,7 +1997,7 @@ lex_source_get_lookahead (struct lex_source *src)
             .macro_rep = macro ? first->macro_rep : NULL,
             .ofs = macro ? first->ofs : 0,
             .len = macro ? (last->ofs - first->ofs) + last->len : 0,
-            .ref_cnt = first->ref_cnt,
+            .ref_cnt = macro ? first->ref_cnt : NULL,
           };
           if (t->ref_cnt)
             ++*t->ref_cnt;