diff options
author | dgp <dgp@users.sourceforge.net> | 2007-04-25 19:07:06 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-04-25 19:07:06 (GMT) |
commit | bc808f183f4c2b6328fe0d9d44396e1147795f84 (patch) | |
tree | 4dbeedb071952dd90f94bae207260b6127fdb9c9 | |
parent | 878b93bf45b4a7326999b5cd61afbe084895a0aa (diff) | |
download | tcl-bc808f183f4c2b6328fe0d9d44396e1147795f84.zip tcl-bc808f183f4c2b6328fe0d9d44396e1147795f84.tar.gz tcl-bc808f183f4c2b6328fe0d9d44396e1147795f84.tar.bz2 |
* generic/tclCompExpr.c (ParseExpr): Revised to be sure that
an error return doesn't prevent all literals getting placed on the
litList to be returned to the caller for freeing. Corrects some
memleaks. [Bug 1705778, leak K23]
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 20 |
2 files changed, 24 insertions, 3 deletions
@@ -1,3 +1,10 @@ +2007-04-25 Don Porter <dgp@users.sourceforge.net> + + * generic/tclCompExpr.c (ParseExpr): Revised to be sure that + an error return doesn't prevent all literals getting placed on the + litList to be returned to the caller for freeing. Corrects some + memleaks. [Bug 1705778, leak K23] + 2007-04-25 Daniel Steffen <das@users.sourceforge.net> * unix/Makefile.in (dist): add macosx/*.xcconfig files to src dist; 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; |