summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-02-28 00:38:09 (GMT)
committerhobbs <hobbs>2002-02-28 00:38:09 (GMT)
commit51f1a7d2d89d74abce6789db5dd7832798e98e0e (patch)
tree4235b5e6da3342549f5abbe0d216cb7f250f8e4a
parent7dad982387340c5d18dd4477e41321739e4b4c42 (diff)
downloadtcl-51f1a7d2d89d74abce6789db5dd7832798e98e0e.zip
tcl-51f1a7d2d89d74abce6789db5dd7832798e98e0e.tar.gz
tcl-51f1a7d2d89d74abce6789db5dd7832798e98e0e.tar.bz2
* generic/tclBasic.c (Tcl_EvalTokensStandard): corrected mem leak
in error case.
-rw-r--r--generic/tclBasic.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 5e8a626..c0fd688 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.48 2002/02/25 23:17:21 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.49 2002/02/28 00:38:09 hobbs Exp $
*/
#include "tclInt.h"
@@ -3246,7 +3246,7 @@ Tcl_EvalTokensStandard(interp, tokenPtr, count)
int count; /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
- Tcl_Obj *resultPtr, *indexPtr, *valuePtr, *newPtr;
+ Tcl_Obj *resultPtr, *indexPtr, *valuePtr;
char buffer[TCL_UTF_MAX];
#ifdef TCL_MEM_DEBUG
# define MAX_VAR_CHARS 5
@@ -3362,9 +3362,8 @@ Tcl_EvalTokensStandard(interp, tokenPtr, count)
Tcl_IncrRefCount(resultPtr);
} else {
if (Tcl_IsShared(resultPtr)) {
- newPtr = Tcl_DuplicateObj(resultPtr);
Tcl_DecrRefCount(resultPtr);
- resultPtr = newPtr;
+ resultPtr = Tcl_DuplicateObj(resultPtr);
Tcl_IncrRefCount(resultPtr);
}
if (valuePtr != NULL) {
@@ -3375,12 +3374,14 @@ Tcl_EvalTokensStandard(interp, tokenPtr, count)
}
if (resultPtr != NULL) {
Tcl_SetObjResult(interp, resultPtr);
- Tcl_DecrRefCount(resultPtr);
} else {
code = TCL_ERROR;
}
done:
+ if (resultPtr != NULL) {
+ Tcl_DecrRefCount(resultPtr);
+ }
return code;
}