summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-23 19:04:41 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-23 19:04:41 (GMT)
commit0346db3d28f76c5cd9878c41fe7401b3eddc9c68 (patch)
tree284942c1ba98ac7dff9d1317f1dbb89c9c143aea /generic/tclCompExpr.c
parent2db8334efef30d1215c4929bd3abc4e3e0598004 (diff)
downloadtcl-0346db3d28f76c5cd9878c41fe7401b3eddc9c68.zip
tcl-0346db3d28f76c5cd9878c41fe7401b3eddc9c68.tar.gz
tcl-0346db3d28f76c5cd9878c41fe7401b3eddc9c68.tar.bz2
* generic/tclCompCmds.c (TclCompileUpvarCmd): Plugged a memory
leak in 'upvar' when compiling (a) upvar outside a proc, (b) upvar with a syntax error, or (c) upvar where the frame index is not known at compile time. * generic/tclParseExpr.c (ParseExpr): Plugged a memory leak when parsing expressions that contain syntax errors.
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index e5cddb3..6acf13e 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.50 2007/04/17 14:49:53 dkf Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.51 2007/04/23 19:04:43 kennykb Exp $
*/
#include "tclInt.h"
@@ -202,7 +202,7 @@ ParseExpr(
* those operands that require run time
* substitutions. */
{
- OpNode *nodes;
+ OpNode *nodes = NULL;
int nodesAvailable = 64, nodesUsed = 0;
int code = TCL_OK;
int numLiterals = 0, numFuncs = 0;
@@ -723,6 +723,9 @@ ParseExpr(
numBytes -= scanned;
}
+ if (code != TCL_OK && nodes != NULL) {
+ ckfree((char*) nodes);
+ }
if (code == TCL_OK) {
*opTreePtr = nodes;
} else if (interp == NULL) {