diff options
author | dgp <dgp@users.sourceforge.net> | 2011-06-21 14:10:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-06-21 14:10:30 (GMT) |
commit | b7b72dccac017f2f30f2c8874fe5bbbc3a2d17a3 (patch) | |
tree | ddeb1ed2f06be006375b0c9ceffd930f1f5c8b45 | |
parent | 82ae58b0bdf616326821b120d988cbf9e0d6090d (diff) | |
parent | 83102e6f2f98d36d59b7b69132074e9724dc2feb (diff) | |
download | tcl-b7b72dccac017f2f30f2c8874fe5bbbc3a2d17a3.zip tcl-b7b72dccac017f2f30f2c8874fe5bbbc3a2d17a3.tar.gz tcl-b7b72dccac017f2f30f2c8874fe5bbbc3a2d17a3.tar.bz2 |
3317466 Prevent multiple Tcl_LinkVar() links to a single Tcl variable.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclLink.c | 8 |
2 files changed, 13 insertions, 0 deletions
@@ -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 00010f3..a3b42bd 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 = ckalloc(sizeof(Link)); linkPtr->interp = interp; linkPtr->varName = Tcl_NewStringObj(varName, -1); |