diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-08-04 23:12:30 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-08-04 23:12:30 (GMT) |
commit | ac6a1491aaf30ac441a0c7bbd5963c3188b722e6 (patch) | |
tree | 0c72f36250fb729c71ed3b3128bc61531adecea0 | |
parent | 1e205f662a0808f3bf55bf56fff31bbf425a1f99 (diff) | |
download | tcl-ac6a1491aaf30ac441a0c7bbd5963c3188b722e6.zip tcl-ac6a1491aaf30ac441a0c7bbd5963c3188b722e6.tar.gz tcl-ac6a1491aaf30ac441a0c7bbd5963c3188b722e6.tar.bz2 |
[Bug 3386197]: Plug memory leak in unstacking of zlib transforms.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | generic/tclZlib.c | 14 |
2 files changed, 23 insertions, 4 deletions
@@ -1,8 +1,13 @@ +2011-08-05 Donal K. Fellows <dkf@users.sf.net> + + * generic/tclZlib.c (ZlibTransformClose): [Bug 3386197]: Plug a memory + leak found by Miguel with valgrind. + 2011-08-04 Miguel Sofer <msofer@users.sf.net> - * generic/tclVar.c (TclPtrSetVar): fix valgrind-detected error - when newValuePtr is the interp's result obj. - + * generic/tclVar.c (TclPtrSetVar): Fix valgrind-detected error when + newValuePtr is the interp's result obj. + 2011-08-04 Donal K. Fellows <dkf@users.sf.net> * generic/tclAssembly.c (FreeAssemblyEnv): [Bug 3384840]: Plug another @@ -149,7 +154,7 @@ 2011-07-07 Miguel Sofer <msofer@users.sf.net> - * generic/tclBasic.c: add missing INT2PTR + * generic/tclBasic.c: Add missing INT2PTR 2011-07-03 Donal K. Fellows <dkf@users.sf.net> diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 3ddc3fb..80431a3 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -2253,7 +2253,16 @@ ZlibTransformClose( ZlibChannelData *cd = instanceData; int e, result = TCL_OK; + /* + * Delete the support timer. + */ + ZlibTransformTimerKill(cd); + + /* + * Flush any data waiting to be compressed. + */ + if (cd->mode == TCL_ZLIB_STREAM_DEFLATE) { cd->outStream.avail_in = 0; do { @@ -2291,6 +2300,10 @@ ZlibTransformClose( e = inflateEnd(&cd->outStream); } + /* + * Release all memory. + */ + if (cd->inBuffer) { ckfree(cd->inBuffer); cd->inBuffer = NULL; @@ -2299,6 +2312,7 @@ ZlibTransformClose( ckfree(cd->outBuffer); cd->outBuffer = NULL; } + ckfree(cd); return result; } |