summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclLink.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index da20558..aebd347 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-21 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclLink.c: Prevent multiple links to a single Tcl
+ variable when calling Tcl_LinkVar(). [Bug 3317466]
+
2011-06-13 Don Porter <dgp@users.sourceforge.net>
* generic/tclStrToD.c: [Bug 3315098] Mem leak fix from Gustaf Neumann.
diff --git a/generic/tclLink.c b/generic/tclLink.c
index df8b16a..f7911a4 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -112,6 +112,14 @@ Tcl_LinkVar(
Link *linkPtr;
int code;
+ linkPtr = (Link *) Tcl_VarTraceInfo(interp, varName, TCL_GLOBAL_ONLY,
+ LinkTraceProc, (ClientData) NULL);
+ if (linkPtr != NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "variable '%s' is already linked", varName));
+ return TCL_ERROR;
+ }
+
linkPtr = (Link *) ckalloc(sizeof(Link));
linkPtr->interp = interp;
linkPtr->varName = Tcl_NewStringObj(varName, -1);