diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-06 13:41:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-06 13:41:37 +0000 |
commit | b268da23d2be376057b6184f2bddf50841f58728 (patch) | |
tree | f8d1a86cebff6c5c12f4adbd4fb2add1485777f6 /test/zlib | |
parent | 4f966c0a680becf29d2174c2e9d53c16a18bf936 (diff) | |
download | bundler-b268da23d2be376057b6184f2bddf50841f58728.tar.gz |
zlib.c: memory leak in gunzip
* ext/zlib/zlib.c (zlib_gunzip): clear zstream to fix memory leak.
[ruby-core:83162] [Bug #13982]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r-- | test/zlib/test_zlib.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index d53717ef74..2d539dda1a 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -1196,5 +1196,13 @@ if defined? Zlib src = %w[1f8b080000000000000].pack("H*") assert_raise(Zlib::GzipFile::Error){ Zlib.gunzip(src) } end + + def test_gunzip_no_memory_leak + assert_no_memory_leak(%[-rzlib], "#{<<~"{#"}", "#{<<~'};'}") + d = Zlib.gzip("data") + {# + 10_000.times {Zlib.gunzip(d)} + }; + end end end |