diff options
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r-- | generic/tclCompExpr.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index b373969..f24c505 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompExpr.c,v 1.52 2007/04/24 15:36:42 dgp Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.53 2007/04/25 19:07:07 dgp Exp $ */ #include "tclInt.h" @@ -349,6 +349,22 @@ ParseExpr( const char *end; int wordIndex; + /* + * Store away any literals on the list now, so they'll + * be available for our caller to free if we error out + * of this routine. [Bug 1705778, leak K23] + */ + + switch (lexeme) { + case NUMBER: + case BOOLEAN: + Tcl_ListObjAppendElement(NULL, litList, literal); + numLiterals++; + break; + default: + break; + } + if (lastWas < 0) { msg = Tcl_ObjPrintf("missing operator at %s", mark); if (lastStart[0] == '0') { @@ -369,8 +385,6 @@ ParseExpr( switch (lexeme) { case NUMBER: case BOOLEAN: - Tcl_ListObjAppendElement(NULL, litList, literal); - numLiterals++; lastWas = OT_LITERAL; start += scanned; numBytes -= scanned; |