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 /generic/tclZlib.c | |
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.
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r-- | generic/tclZlib.c | 14 |
1 files changed, 14 insertions, 0 deletions
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; } |