diff options
| author | dgp@users.sourceforge.net <dgp> | 2011-08-12 16:10:12 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2011-08-12 16:10:12 (GMT) |
| commit | 60b70589e1ed9ed83f11dd72cc683fbc557d7d77 (patch) | |
| tree | 57c4dbaffbd553216e83d3d661f0e7a31959fe1a | |
| parent | 2a053849d62aa8f9dc66b890d281e921b50ccb2b (diff) | |
| parent | ae4685f6aa69ad61889a9132d1025310cb8c8f74 (diff) | |
| download | tcl-60b70589e1ed9ed83f11dd72cc683fbc557d7d77.zip tcl-60b70589e1ed9ed83f11dd72cc683fbc557d7d77.tar.gz tcl-60b70589e1ed9ed83f11dd72cc683fbc557d7d77.tar.bz2 | |
3389764 Eliminate possibility that "path" value dup can create reference cycle.
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | generic/tclPathObj.c | 24 |
2 files changed, 17 insertions, 12 deletions
@@ -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-12 Donal K. Fellows <dkf@users.sf.net> * generic/tclZlib.c (ZlibTransformOutput): [Bug 3390073]: Return the diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index d9e3973..205c301 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -2617,29 +2617,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; |
