diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-12-28 17:37:48 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-12-28 17:37:48 (GMT) |
commit | a7b4a7560837d1f6f303dc6ee53db1a2c849aebb (patch) | |
tree | 894da08b1a2b6c54ba913c00e0392abd818f2913 | |
parent | a7e88f6d17b8ff68c0cb6f10840445088d5264f0 (diff) | |
download | tcl-a7b4a7560837d1f6f303dc6ee53db1a2c849aebb.zip tcl-a7b4a7560837d1f6f303dc6ee53db1a2c849aebb.tar.gz tcl-a7b4a7560837d1f6f303dc6ee53db1a2c849aebb.tar.bz2 |
Plug memory leak.
-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); |