summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authormig <mig>2011-08-04 18:40:05 (GMT)
committermig <mig>2011-08-04 18:40:05 (GMT)
commit1e205f662a0808f3bf55bf56fff31bbf425a1f99 (patch)
treeb2746d02acb430da74969ceb1bd3d4bd27f12fed /generic/tclVar.c
parenta919f9d8847122e540b39459604823b06bffd0eb (diff)
downloadtcl-1e205f662a0808f3bf55bf56fff31bbf425a1f99.zip
tcl-1e205f662a0808f3bf55bf56fff31bbf425a1f99.tar.gz
tcl-1e205f662a0808f3bf55bf56fff31bbf425a1f99.tar.bz2
* generic/tclVar.c (TclPtrSetVar): fix valgrind-detected error when newValuePtr is the interp's result obj.
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 55c031c..62bf1c4 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -1826,6 +1826,7 @@ TclPtrSetVar(
Tcl_Obj *oldValuePtr;
Tcl_Obj *resultPtr = NULL;
int result;
+ int cleanupOnEarlyError = (newValuePtr->refCount == 0);
/*
* If the variable is in a hashtable and its hPtr field is NULL, then we
@@ -1997,7 +1998,7 @@ TclPtrSetVar(
return resultPtr;
earlyError:
- if (newValuePtr->refCount == 0) {
+ if (cleanupOnEarlyError) {
Tcl_DecrRefCount(newValuePtr);
}
goto cleanup;