Tcl Source Code

View Ticket
Login
Ticket UUID: 983501
Title: Resource leak in [pkgconfig] ?
Type: Bug Version: obsolete: 8.5a2
Submitter: dgp Created on: 2004-07-01 15:51:45
Subsystem: 54. Configuration Reporting Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2007-11-29 02:23:11
Resolution: Fixed Closed By: dgp
    Closed on: 2007-11-28 19:23:11
Description:
Tcl_RegisterConfig() creates a [pkgconfig]
command.  Configuration values are stored
in a dictionary, and the [pkgconfig] command
provides read access to the dictionary.

When the [pkgconfig] command is
deleted from the interp, the dictionary
of data remains, it is not freed until
the interp is deleted.  The elements
of the dictionary may be freed as they
are overwritten by a later call to 
Tcl_RegisterConfig() on the same interp.

Besides an unbalanced cleanup, this
also opens the possibility of having
[pkgconfig] return data values that
are a mixture of different Tcl_RegisterConfig()
calls (possibly from multiple versions of
the same package?).

I think we want QueryConfigDelete() to
clear the dictionary of data.
User Comments: dgp added on 2007-11-29 02:23:11:
Logged In: YES 
user_id=80530
Originator: YES

committed for 8.5.0

andreas_kupries added on 2007-11-29 01:38:24:
Logged In: YES 
user_id=75003
Originator: NO

Patch looks good.

dgp added on 2007-11-29 01:24:38:

File Added - 256479: 983501.patch

Logged In: YES 
user_id=80530
Originator: YES


Here's a patch for review.
File Added: 983501.patch

andreas_kupries added on 2007-11-28 01:19:53:
Logged In: YES 
user_id=75003
Originator: NO

Nothing was done :(

I have no objections to deletion via QueryConfigDelete() when the command goes away.

dgp added on 2007-11-28 00:53:47:
Logged In: YES 
user_id=80530
Originator: YES


status?

andreas_kupries added on 2006-03-28 01:11:57:
Logged In: YES 
user_id=75003

This is not blocker for the a4 release IMHO.

andreas_kupries added on 2004-07-17 02:33:49:
Logged In: YES 
user_id=75003

Agree. But we have a problem here. QueryConfigDelete does
not get the interp, but the dictionary you ask it to delete
is found only through the assoc data of an interp. So we
can't find the dict right now.

This requires a change to the client data of the command.
Instead of the package name, as done right now we have to
use a struct which contains the package name, and a
reference to the relevant interp. the name is required
everywhere, the interp is relevant only for the cleanup.

Attachments: