summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-08-12 15:59:40 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-08-12 15:59:40 (GMT)
commit368a70fb725d84b0997d6b9826a3851c87035e8c (patch)
tree2048f117b6b1078ce0733013042aa312060b5de3
parentf0ac2a42dacd012d571e820af585805230045d01 (diff)
downloadtcl-368a70fb725d84b0997d6b9826a3851c87035e8c.zip
tcl-368a70fb725d84b0997d6b9826a3851c87035e8c.tar.gz
tcl-368a70fb725d84b0997d6b9826a3851c87035e8c.tar.bz2
3389764 Eliminate possibility that "path" value dup can create reference cycle.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclPathObj.c24
2 files changed, 17 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 54a718c..bbe93e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-12 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclPathObj.c: [Bug 3389764] Eliminate possibility that dup
+ of a "path" value can create reference cycle.
+
2011-08-09 Jan Nijtmans <nijtmans@users.sf.net>
* win/tclWinConsole.c: [Bug 3388350] mingw64 compiler warnings
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index da3b280..8840e4a 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -2669,29 +2669,29 @@ DupFsPathInternalRep(
SETPATHOBJ(copyPtr, copyFsPathPtr);
- if (srcFsPathPtr->translatedPathPtr != NULL) {
+ if (srcFsPathPtr->translatedPathPtr == srcPtr) {
+ /* Cycle in src -> make cycle in copy. */
+ copyFsPathPtr->translatedPathPtr = copyPtr;
+ } else {
copyFsPathPtr->translatedPathPtr = srcFsPathPtr->translatedPathPtr;
- if (copyFsPathPtr->translatedPathPtr != copyPtr) {
+ if (copyFsPathPtr->translatedPathPtr != NULL) {
Tcl_IncrRefCount(copyFsPathPtr->translatedPathPtr);
}
- } else {
- copyFsPathPtr->translatedPathPtr = NULL;
}
- if (srcFsPathPtr->normPathPtr != NULL) {
+ if (srcFsPathPtr->normPathPtr == srcPtr) {
+ /* Cycle in src -> make cycle in copy. */
+ copyFsPathPtr->normPathPtr = copyPtr;
+ } else {
copyFsPathPtr->normPathPtr = srcFsPathPtr->normPathPtr;
- if (copyFsPathPtr->normPathPtr != copyPtr) {
+ if (copyFsPathPtr->normPathPtr != NULL) {
Tcl_IncrRefCount(copyFsPathPtr->normPathPtr);
}
- } else {
- copyFsPathPtr->normPathPtr = NULL;
}
- if (srcFsPathPtr->cwdPtr != NULL) {
- copyFsPathPtr->cwdPtr = srcFsPathPtr->cwdPtr;
+ copyFsPathPtr->cwdPtr = srcFsPathPtr->cwdPtr;
+ if (copyFsPathPtr->cwdPtr != NULL) {
Tcl_IncrRefCount(copyFsPathPtr->cwdPtr);
- } else {
- copyFsPathPtr->cwdPtr = NULL;
}
copyFsPathPtr->flags = srcFsPathPtr->flags;