summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-06-22 17:06:42 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-06-22 17:06:42 (GMT)
commite276d32be530892ebd4fd2a0fb1fd99fee8c3b50 (patch)
treea57115dece1197dd399f55be94fbe191faa22fb3
parentf81f14146b45e2134cf88261271a8440bb1a3405 (diff)
parentfc25ed040a2abd529c7aa70e95e5a2981a13c92a (diff)
downloadtcl-e276d32be530892ebd4fd2a0fb1fd99fee8c3b50.zip
tcl-e276d32be530892ebd4fd2a0fb1fd99fee8c3b50.tar.gz
tcl-e276d32be530892ebd4fd2a0fb1fd99fee8c3b50.tar.bz2
merge 8.5
-rw-r--r--generic/tclIOUtil.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 117fab3..d397a16 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -481,6 +481,7 @@ FsThrExitProc(
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
if (--fsRecPtr->fileRefCount <= 0) {
+ fsRecPtr->fsPtr = NULL;
ckfree((char *)fsRecPtr);
}
fsRecPtr = tmpFsRecPtr;
@@ -588,7 +589,7 @@ static void
FsRecacheFilesystemList(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
- FilesystemRecord *fsRecPtr, *tmpFsRecPtr = NULL, *chain = NULL;
+ FilesystemRecord *fsRecPtr, *tmpFsRecPtr = NULL, *toFree = NULL, *chain = NULL;
/*
* Trash the current cache.
@@ -599,7 +600,9 @@ FsRecacheFilesystemList(void)
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
if (--fsRecPtr->fileRefCount <= 0) {
- ckfree((char *)fsRecPtr);
+ fsRecPtr->fsPtr = NULL;
+ fsRecPtr->nextPtr = toFree;
+ toFree = fsRecPtr;
}
fsRecPtr = tmpFsRecPtr;
}
@@ -639,6 +642,12 @@ FsRecacheFilesystemList(void)
tsdPtr->filesystemList = tmpFsRecPtr;
fsRecPtr = fsRecPtr->prevPtr;
}
+
+ while (toFree) {
+ FilesystemRecord *next = toFree->nextPtr;
+ ckfree((char *)toFree);
+ toFree = next;
+ }
tsdPtr->filesystemEpoch = theFilesystemEpoch;
Tcl_MutexUnlock(&filesystemMutex);