diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-06 21:49:26 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-06 21:49:26 +0000 |
commit | 0056c3cd636c501cd8f6bf4df02ae57ec106a909 (patch) | |
tree | 5e889961fd8164793f824420e1f98b310c5d930e /regress/lib | |
parent | 6af7521cd032d3b6e95e7fae48af84175f8ba75c (diff) |
from bgpd:
plug a memory leak in the lexer.
the issue is this code fragement from yylex():
. token = lookup(buf);
. yylval.v.string = strdup(buf);
. if (yylval.v.string == NULL)
. err(1, "yylex: strdup");
. return (token);
lookup() tries to match buf against a list of keywords, and returns the
associated token if it has a match, or the token STRING otherwise.
STRING is the only token that needs (and free()s) yylval.v.string. however,
we assigned memory for it with the strdup in yylex for each and every token.
the fix is obviously only setting yylval.v.string when lookup() returns STRING.
Patrick Latifi noticed that something was leaking with token handling,
analysis and fix by me.
ok deraadt@
Diffstat (limited to 'regress/lib')
0 files changed, 0 insertions, 0 deletions