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 12d6911..fda5ff5 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -1916,6 +1916,9 @@ TclPtrSetVar(
Tcl_IncrRefCount(oldValuePtr); /* Since var is ref */
}
Tcl_AppendObjToObj(oldValuePtr, newValuePtr);
+ if (newValuePtr->refCount == 0) {
+ Tcl_DecrRefCount(newValuePtr);
+ }
}
}
} else if (newValuePtr != oldValuePtr) {