cmListFileLexer: Fix leak on error before EOF
Teach cmListFileLexerDestroy to call cmListFileLexerSetToken with a NULL token to free the token string buffer. Without this, if an error occurs before the token cleanup happens when EOF is reached, then the token string buffer may leak.
This commit is contained in:
parent
40c76c1dc8
commit
ad3d5c59b3
|
@ -2271,6 +2271,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer)
|
|||
/*--------------------------------------------------------------------------*/
|
||||
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
|
||||
{
|
||||
cmListFileLexerSetToken(lexer, 0, 0);
|
||||
if(lexer->file || lexer->string_buffer)
|
||||
{
|
||||
cmListFileLexer_yylex_destroy(lexer->scanner);
|
||||
|
|
|
@ -292,6 +292,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer)
|
|||
/*--------------------------------------------------------------------------*/
|
||||
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
|
||||
{
|
||||
cmListFileLexerSetToken(lexer, 0, 0);
|
||||
if(lexer->file || lexer->string_buffer)
|
||||
{
|
||||
cmListFileLexer_yylex_destroy(lexer->scanner);
|
||||
|
|
Loading…
Reference in New Issue