Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Memory leak in Tcl_Import function (file=tclNamesp.c)

Closed / Accepted403755ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2001-02-12 20:58:41
In Tcl_Import function, the following variable is initialized but never freed:

                Tcl_DString ds;
                Tcl_DStringInit(&ds);
                Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
                  ...

This will result in memory leak. The attached  patch fixes this problem.

Note that the patch is similar to the  Tcl_DStringFree(&ds) call found in
Tcl_ProcObjCmd function in tclProc.c file.

Thanks,
Hemang.
hobbsplain2001-02-14 09:26:38
It does indeed seem to be the case that the DString
initialized in that block is never freed.  I'm surprised
that Purify never picked up this leak.  This looks to be
in the path of 'namespace import'.
dgp Ticket [403755ffff]: 1 change [History diff]2001-02-22 07:19:02
hobbsplain2001-03-24 08:16:52
Logged In: YES 
user_id=72656

Added to 8.4a2 sources 23 Mar 2001.
dgp Ticket [403755ffff]: 3 changes [History diff]2001-03-24 22:23:29
Log in (anonymous is fine) to add a comment.

Attachments: