Skip to content
Tcl Source Code View Ticket
Login

View Ticket

mem leak in Tcl_GetsObjCmd ?

Closed / Fixed517503ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-02-14 13:32:06
While looking through the sources, I have stumbled
accross something that looks to me like a possible
memory leak. I may be missing something though.

The issue is in function Tcl_GetsObjCmd (tclIOCmd.c):
on line 253 we see
    if (objc == 3) {
Tcl_DecrRefCount(linePtr);
    }
I think that linePtr should be Tcl_DecrRefCount'ed also
when objc is not equal to 3.

As it is, I suspect the linePtr object will be leaked
when there is an error reading the channel in
                  set myVar [gets $chan]
i.e., with (objc == 2)
dkfplain2002-02-14 21:19:04
Logged In: YES 
user_id=79902

Looks like a leak to me, though an awkward one to hit in
practice.
andreas_kupries Ticket [517503ffff]: 1 change [History diff]2002-02-15 00:26:20
andreas_kupriesplain2002-02-15 02:05:37
Logged In: YES 
user_id=75003

I agree.
andreas_kupriesplain2002-02-15 02:11:59
Logged In: YES 
user_id=75003

Trivial patch. Please review :)
andreas_kupriesplain2002-02-15 02:12:00
File Added - 17880: 517503.diff
msoferplain2002-02-15 02:19:23
Logged In: YES 
user_id=148712

Yep, that's it.
andreas_kupriesplain2002-02-15 02:24:55
Logged In: YES 
user_id=75003

Committed to head.
Log in (anonymous is fine) to add a comment.

Attachments: