Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-02-15
02:24 • Closed ticket [517503ffff]: mem leak in Tcl_GetsObjCmd ? plus 7 other change... artifact: 3201a25385 user: andreas_kupries
02:19 • Ticket [517503ffff]: 6 changes artifact: ff08adbb88 user: msofer
02:12 • Ticket [517503ffff]: 4 changes artifact: b59e48d6fe user: andreas_kupries
02:11 • Add attachment 517503.diff to ticket [517503ffff] artifact: 340dffc68e user: andreas_kupries
02:11 • Ticket [517503ffff] mem leakin Tcl_GetsObjCmd ? status still Open with 5 oth... artifact: 2bb948a8a9 user: andreas_kupries
02:05 • Ticket [517503ffff]: 4 changes artifact: 96f795e631 user: andreas_kupries
00:26 • Ticket [517503ffff]: 1 change artifact: 6afb121bb0 user: andreas_kupries
2002-02-14
21:19 • Ticket [517503ffff]: 4 changes artifact: ceb501edf0 user: dkf
13:32 • New ticket [517503ffff]. artifact: 0d2e77b366 user: msofer

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: