summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileLexer.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-09-17 14:24:17 (GMT)
committerBrad King <brad.king@kitware.com>2013-09-17 14:27:08 (GMT)
commitad3d5c59b3c57112e3b96812ee8a66b08dcd864e (patch)
treef864a5ecfc989d2640b559fe3aa0e8f667db8a61 /Source/cmListFileLexer.c
parent40c76c1dc84867aae6ef1b6138abed5de3eeb28b (diff)
downloadCMake-ad3d5c59b3c57112e3b96812ee8a66b08dcd864e.zip
CMake-ad3d5c59b3c57112e3b96812ee8a66b08dcd864e.tar.gz
CMake-ad3d5c59b3c57112e3b96812ee8a66b08dcd864e.tar.bz2
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.
Diffstat (limited to 'Source/cmListFileLexer.c')
-rw-r--r--Source/cmListFileLexer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index 2841fe5..f127add 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -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);