From 8aaae44c72a0646134d69e54c06bd08c53b5d53d Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 12 Apr 2002 06:37:20 +0000 Subject: * generic/tkPanedWindow.c (DestroyPanedWindow, ConfigureSlaves): fix mem leaks in not freeing slave info --- generic/tkPanedWindow.c | 10 +++++++--- 1 file 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. -- cgit v0.12