Ticket UUID: | 478c446889d74995ad6e0ac0b5602c01d7e215d9 | |||
Title: | zlib inflate leaking memory on Z_STREAM_ERROR condition | |||
Type: | Bug | Version: | 8.6.4 | |
Submitter: | bovine | Created on: | 2015-06-10 18:06:51 | |
Subsystem: | 57. zlib | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Important | |
Status: | Closed | Last Modified: | 2015-06-11 02:50:42 | |
Resolution: | Fixed | Closed By: | mistachkin | |
Closed on: | 2015-06-11 02:50:42 | |||
Description: |
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. | |||
User Comments: |
mistachkin added on 2015-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). bovine added on 2015-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? |
Attachments:
- leaky.tcl [download] added by bovine on 2015-06-10 18:22:58. [details]