projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
47ddf8f
)
lexer: Fix memory leak merging tokens only some of which come from macros.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 9 Oct 2021 17:10:35 +0000
(10:10 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 9 Oct 2021 17:10:35 +0000
(10:10 -0700)
Found by Address Sanitizer.
src/language/lexer/lexer.c
patch
|
blob
|
history
diff --git
a/src/language/lexer/lexer.c
b/src/language/lexer/lexer.c
index 9a7d3ce1300c69853e3766aabc68888c56dda520..2218caadd7e4c525453b3d3d855bc0f0daf5a377 100644
(file)
--- a/
src/language/lexer/lexer.c
+++ b/
src/language/lexer/lexer.c
@@
-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;