|
2015-06-11
| ||
| 02:50 | • Closed ticket [478c446889]: zlib inflate leaking memory on Z_STREAM_ERROR condit... artifact: 12ad083cfc user: mistachkin | |
| 02:47 | Plug memory leaks in the Tcl_ZlibInflate() error handling code. Fix for ticket [478c446889]. check-in: 513c7ae3fc user: mistachkin tags: trunk | |
|
2015-06-10
| ||
| 18:22 | • Add attachment leaky.tcl to ticket [478c446889] artifact: 31bc4e7e63 user: bovine | |
| 18:13 | • Ticket [478c446889] zlib inflate leaking memory on Z_STREAM_ERROR condition ... artifact: 04f96076ab user: bovine | |
| 18:06 | • New ticket [478c446889]. artifact: 4b282ca1b4 user: bovine | |
zlib inflate leaking memory on Z_STREAM_ERROR condition
Closed / Fixed478c446889d74995ad6e0ac0b5602c01d7e215d9Created 11 years agoUpdated 11 years ago
Descriptionplain2015-06-10 18:06:51
In Tcl_ZlibInflate of generic/tclZlib.c there is this error block:
if ((stream.avail_in == 0) && (stream.avail_out > 0)) {
e = Z_STREAM_ERROR;
goto error;
}
I believe that needs to call inflateEnd(&stream) before the goto to avoid leaking zlib memory structures. This leak would only occur if you are trying to decompress corrupted/incomplete data a lot.
Referenced by1
513c7ae3fcPlug memory leaks in the Tcl_ZlibInflate() error handling code. Fix for ticket [478c446889]. check-in2015-06-11 02:47:41
bovineplain2015-06-10 18:13:06
Is there perhaps also a leak in this error block earlier in that function?
if (headerPtr) {
e = inflateGetHeader(&stream, headerPtr);
if (e != Z_OK) {
goto error;
}
}
I think that should also call inflateEnd(&stream) prior to the goto?
mistachkinplain2015-06-11 02:50:42
Fixed on trunk via check-in [513c7ae3fcc2b76a]. There is no easy way to automatically test this; however, I manually verified it by observing the process memory usage with and without the fix (i.e. without the fix, the memory usage kept growing).
Log in (anonymous is fine) to add a comment.