summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclVar.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 4694cd8..5e3157e 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -1958,6 +1958,9 @@ TclPtrSetVar(
Tcl_IncrRefCount(oldValuePtr); /* Since var is ref */
}
Tcl_AppendObjToObj(oldValuePtr, newValuePtr);
+ if (newValuePtr->refCount == 0) {
+ Tcl_DecrRefCount(newValuePtr);
+ }
}
}
} else if (newValuePtr != oldValuePtr) {