The lexer always allocates a duplicate string via strdup for STR
tokens. The parse handlers did not always free these duplicated
strings after consuming them.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I did not, but AFAIK, the ucl_get_* routines don't return storage to the caller. They seem to be more like nvlist_get_* rather than nvlist_take_*. In particular, the uclparse.c code is already careful to strdup() any strings it wants to save in the configuration.
Note that after my changes later in this series, we always do the same for the yacc/lex parser as well, and we probably could remove the strdup() calls in token.l and all the free() calls in parse.y which would simplify things a bit.