Tcl Source Code

View Ticket
Login
Ticket UUID: 403755
Title: Memory leak in Tcl_Import function (file=tclNamesp.c)
Type: Patch Version: None
Submitter: hemanglavana Created on: 2001-02-12 20:58:41
Subsystem: 21. [namespace] Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-03-24 22:23:29
Resolution: Accepted Closed By: dgp
    Closed on: 2001-03-24 15:23:29
Description:
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.
User Comments: hobbs added on 2001-03-24 08:16:52:
Logged In: YES 
user_id=72656

Added to 8.4a2 sources 23 Mar 2001.

hobbs added on 2001-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'.

Attachments: