diff options
author | vincentdarley <vincentdarley> | 2002-07-08 12:08:34 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-07-08 12:08:34 (GMT) |
commit | 284a565718399779d86f434a058a3d2880270e8f (patch) | |
tree | c998b7a4adf7ece8d82aa33f2b7c1a4643ddc722 /generic | |
parent | 095d33883b3a4b3d586f2c39679ca943b7e344e4 (diff) | |
download | tcl-284a565718399779d86f434a058a3d2880270e8f.zip tcl-284a565718399779d86f434a058a3d2880270e8f.tar.gz tcl-284a565718399779d86f434a058a3d2880270e8f.tar.bz2 |
no zero refcount in Tcl_FS
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIOUtil.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index d779b5c..d273e6c 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.53 2002/07/08 10:11:22 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.54 2002/07/08 12:08:34 vincentdarley Exp $ */ #include "tclInt.h" @@ -4757,6 +4757,17 @@ Tcl_FSGetFileSystemForPath(pathObjPtr) Tcl_Filesystem* retVal = NULL; FsPath* srcFsPathPtr; + /* + * If the object has a refCount of zero, we reject it. This + * is to avoid possible segfaults or nondeterministic memory + * leaks (i.e. the user doesn't know if they should decrement + * the ref count on return or not). + */ + + if (pathObjPtr->refCount == 0) { + return NULL; + } + /* Make sure pathObjPtr is of our type */ if (Tcl_FSConvertToPathType(NULL, pathObjPtr) != TCL_OK) { |