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 | 58a1e1c841959fc88484618888fe1630191e20da (patch) | |
tree | f8d1a86cebff6c5c12f4adbd4fb2add1485777f6 /test/zlib | |
parent | b94e3a8d742ed49ecf58325708c506cd09478fbf (diff) | |
download | ruby-58a1e1c841959fc88484618888fe1630191e20da.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 |