Tk Source Code

View Ticket
Login
Ticket UUID: 220708
Title: tkUnixWm memory leak
Type: Bug Version: obsolete: 8.3
Submitter: welch Created on: 2000-10-31 23:49:25
Subsystem: 67. Unix Window Operations Assigned To: nobody
Priority: 2 Severity:
Status: Closed Last Modified: 2001-03-23 02:16:50
Resolution: Fixed Closed By: dgp
    Closed on: 2001-03-22 19:16:50
Description:
OriginalBugID: 4405 Bug
Version: 8.3
SubmitDate: '2000-03-20'
LastModified: '2000-03-27'
Severity: SER
Status: Released
Submitter: techsupp
ChangedBy: ericm
OS: All Unix
FixedDate: '2000-03-27'
FixedInVersion: 8.3.1


Name:

Huver Hu



ReproducibleScript:

keep on creating new children top-levels with the same group leader.



ObservedBehavior:

a few of the places where allocated memory are not freed.



DesiredBehavior:

see diff attached.



Patch:

*** tkUnixWm.c.orig     Thu Feb 10 02:53:19 2000

--- tkUnixWm.c  Wed Feb 23 21:40:38 2000

***************

*** 1230,1235 ****

--- 1230,1238 ----

            }

            wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);

            wmPtr->hints.flags |= WindowGroupHint;

+           if (wmPtr->leaderName != NULL) {

+               ckfree((char *) wmPtr->leaderName);

+           }

            wmPtr->leaderName = ckalloc((unsigned) (strlen(argv[3])+1));

            strcpy(wmPtr->leaderName, argv[3]);

        }

***************

*** 1354,1359 ****

--- 1357,1365 ----

                    TCL_STATIC);

            return TCL_OK;

        } else {

+           if (wmPtr->iconName != NULL) {

+               ckfree((char *) wmPtr->iconName);

+           }

            wmPtr->iconName = ckalloc((unsigned) (strlen(argv[3]) + 1));

            strcpy(wmPtr->iconName, argv[3]);

            if (!(wmPtr->flags & WM_NEVER_MAPPED)) {

***************

*** 1847,1852 ****

--- 1853,1861 ----

                    TCL_STATIC);

            return TCL_OK;

        } else {

+           if (wmPtr->title != NULL) {

+               ckfree((char *) wmPtr->title);

+           }

            wmPtr->title = ckalloc((unsigned) (strlen(argv[3]) + 1));

            strcpy(wmPtr->title, argv[3]);

            if (!(wmPtr->flags & WM_NEVER_MAPPED)) {

***************

*** 1903,1908 ****

--- 1912,1920 ----

                CreateWrapper(wmPtr2);

            }

            wmPtr->master = Tk_WindowId(wmPtr2->wrapperPtr);

+           if (wmPtr->masterWindowName != NULL) {

+               ckfree((char *) wmPtr->masterWindowName);

+           }

            wmPtr->masterWindowName = ckalloc((unsigned) (strlen(argv[3])+1));

            strcpy(wmPtr->masterWindowName, argv[3]);

        }



PatchFiles:

unix/tkUnixWm.c





Good find, and thanks for the patch.  I applied it to the CVS repository.  The fix will go out with Tcl/Tk 8.3.1.

- eric

-- 03/27/2000 ericm