Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3713 lsort can leak memory in error case

obsolete: 8.5a6
closed-fixed
5
2007-06-30
2007-05-11
afredd
No

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.

Discussion

    • status: open --> closed-fixed