diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | generic/tclZlib.c | 14 |
2 files changed, 15 insertions, 3 deletions
@@ -1,3 +1,7 @@ +2008-12-28 Donal K. Fellows <dkf@users.sf.net> + + * generic/tclZlib.c (Tcl_ZlibStreamPut): Plug a memory leak. + 2008-12-27 Donal K. Fellows <dkf@users.sf.net> * generic/tclZlib.c (ZlibStreamCmd): Fix compilation consistency. [Bug diff --git a/generic/tclZlib.c b/generic/tclZlib.c index f932525..5fefab7 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclZlib.c,v 1.20 2008/12/27 10:07:06 dkf Exp $ + * RCS: @(#) $Id: tclZlib.c,v 1.21 2008/12/28 17:37:48 dkf Exp $ */ #include "tclInt.h" @@ -963,6 +963,10 @@ Tcl_ZlibStreamPut( Tcl_ListObjAppendElement(NULL, zsh->outData, obj); } + + if (dataTmp) { + ckfree(dataTmp); + } } else { /* * This is easy. Just append to the inData list. @@ -1090,6 +1094,10 @@ Tcl_ZlibStreamGet( zsh->currentInput = 0; } + /* + * Get the next block of data to go to inflate. + */ + Tcl_ListObjIndex(zsh->interp, zsh->inData, 0, &itemObj); itemPtr = Tcl_GetByteArrayFromObj(itemObj, &itemLen); Tcl_IncrRefCount(itemObj); @@ -1098,14 +1106,14 @@ Tcl_ZlibStreamGet( zsh->stream.avail_in = itemLen; /* - * And remove it from the list. + * Remove it from the list. */ Tcl_ListObjReplace(NULL, zsh->inData, 0, 1, 0, NULL); listLen--; /* - * And call inflate again + * And call inflate again. */ e = inflate(&zsh->stream, zsh->flush); |