diff options
author | hobbs <hobbs> | 2002-04-12 06:37:20 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-04-12 06:37:20 (GMT) |
commit | 8aaae44c72a0646134d69e54c06bd08c53b5d53d (patch) | |
tree | 56d066298612b65c99c8984590194f5fbb983ebf /generic | |
parent | 7c0a8d65834f1edbb4ff83719fb790a47a54f5db (diff) | |
download | tk-8aaae44c72a0646134d69e54c06bd08c53b5d53d.zip tk-8aaae44c72a0646134d69e54c06bd08c53b5d53d.tar.gz tk-8aaae44c72a0646134d69e54c06bd08c53b5d53d.tar.bz2 |
* generic/tkPanedWindow.c (DestroyPanedWindow, ConfigureSlaves):
fix mem leaks in not freeing slave info
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkPanedWindow.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 6c38ac5..6091f91 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPanedWindow.c,v 1.2 2002/02/22 21:07:23 hobbs Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.3 2002/04/12 06:37:20 hobbs Exp $ */ #include "tkPort.h" @@ -967,8 +967,9 @@ ConfigureSlaves(pwPtr, interp, objc, objv) * Allocate the new slaves array, then copy the slaves into it, in * order. */ - new = (Slave **)ckalloc(sizeof(Slave *) * (pwPtr->numSlaves+numNewSlaves)); - memset(new, 0, sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves)); + i = sizeof(Slave *) * (pwPtr->numSlaves+numNewSlaves); + new = (Slave **)ckalloc((unsigned) i); + memset(new, 0, (size_t) i); if (index == -1) { /* * If none of the existing slaves have to be moved, just copy the old @@ -1506,6 +1507,9 @@ DestroyPanedWindow(pwPtr) ckfree((void *)pwPtr->slaves[i]); pwPtr->slaves[i] = NULL; } + if (pwPtr->slaves) { + ckfree((char *) pwPtr->slaves); + } /* * Remove the widget command from the interpreter. |