--- old-tclFileName.c	2005-10-18 07:42:59.000000000 -0700
+++ new-tclFileName.c	2005-10-22 10:37:39.812500000 -0700
@@ -10,7 +10,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclFileName.c,v 1.72 2005/10/18 14:42:59 dkf Exp $
+ * RCS: @(#) $Id: tclFileName.c 782 2005-10-20 00:55:38Z eric.melbardis@netkitsolutions.com $
  */
 
 #include "tclInt.h"
@@ -1504,6 +1504,7 @@
 		Tcl_DStringAppend(&prefix, separators, 1);
 	    }
 	}
+
 	if (TclGlob(interp, Tcl_DStringValue(&prefix), pathOrDir, globFlags,
 		globTypes) != TCL_OK) {
 	    result = TCL_ERROR;
@@ -1692,6 +1693,11 @@
 	    }
 	    *tail = c;
 	    if (head == NULL) {
+                /* cleanup EPM */
+                if (pathPrefix) {
+                    Tcl_DecrRefCount(pathPrefix);
+                }
+
 		if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
 		    return TCL_OK;
 		} else {
@@ -1773,6 +1779,11 @@
 
 		if (cwd == NULL) {
 		    Tcl_DecrRefCount(temp);
+                    /* cleanup EPM */
+                    if (pathPrefix) {
+                        Tcl_DecrRefCount(pathPrefix);
+                    }
+
 		    if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
 			return TCL_OK;
 		    } else {
@@ -1868,6 +1879,10 @@
      */
 
     if (result != TCL_OK) {
+        /* cleanup EPM */
+        if (pathPrefix) {
+            Tcl_DecrRefCount(pathPrefix);
+        }
 	TclDecrRefCount(filenamesObj);
 	if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
 	    /* Put back the old result and reset the return code */
@@ -1952,6 +1967,10 @@
     TclDecrRefCount(savedResultObj);
     TclDecrRefCount(filenamesObj);
 
+    /* cleanup EPM */
+    if (pathPrefix) {
+        Tcl_DecrRefCount(pathPrefix);
+    }
     return result;
 }
 
