Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-06-30
21:09 • Closed ticket [1717186fff]: lsort can leak memory in error case plus 3 other... artifact: fdcc548856 user: dkf
2007-05-11
12:49 • New ticket [1717186fff]. artifact: 96dc99bc1a user: afredd

lsort can leak memory in error case

Closed / Fixed1717186fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 19 years ago
Descriptionplain2007-05-11 12:49:48
The listObj is not free'd in the error case where
the given -command string is not a valid list:

Consider:

proc A {} {
 set lst [lrepeat 999 999]
 catch {
  lsort -command "foo \{" $lst
 }
}
while 1 { A } ;# leaks


Just needs a

 Tcl_DecrRefCount(listObj);

in the 

 if (Tcl_ListObjAppendElement(interp, newCommandPtr, newObjPtr) != TCL_OK)

block.
dkf Closed ticket [1717186fff]. [History diff]2007-06-30 21:09:00
Log in (anonymous is fine) to add a comment.