Tcl Source Code

View Ticket
Login
Ticket UUID: 2688184
Title: Tcl_Obj leak in TclpObjNormalizePath (tclWinFile.c)
Type: Bug Version: obsolete: 8.6b1.1
Submitter: mistachkin Created on: 2009-03-16 04:08:25
Subsystem: 36. Pathname Management Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2009-03-19 00:19:10
Resolution: Fixed Closed By: dgp
    Closed on: 2009-03-18 17:19:10
Description:
The TclpObjNormalizePath function in tclWinFile.c has an object leak.  The original object is allocated here:

Tcl_Obj *to = WinReadLinkDirectory(nativePath);

The value of the "to" variable is later assigned to the "temp" variable:  

if (temp != NULL) {
    Tcl_DecrRefCount(temp);
}
temp = to;

The intermediate values of the "temp" variable are properly freed; however, the final value of the "temp" variable is not freed after the containing while loop exits.

The simplest way to I have found to reproduce this leak is to use [file normalize] on a path that uses NT reparse points.

This leak also appears to impact Tcl 8.4 and 8.5.
User Comments: dgp added on 2009-03-19 00:19:10:

allow_comments - 1


backports complete.

dgp added on 2009-03-19 00:08:42:
Patch looks correct.  Committing to HEAD...

mistachkin added on 2009-03-16 11:28:45:

File Added - 317988: tclWinFile.zip

Patch (against HEAD) with fix attached.

File Added: tclWinFile.zip

Attachments: