diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-03 02:25:37 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-03 02:25:37 +0000 |
commit | ce2bc45ae8679b40e97d6794e4e7a31b68444615 (patch) | |
tree | b48256dafb55153e121aa5a8ae04e1711b373413 /test/zlib | |
parent | 05ba99388d1133a99153044be67d7ae3b3dc4de5 (diff) |
merge revision(s) 60042,60130,60131: [Backport #13982]
ext: adjust indent [ci skip]
zlib.c: memory leak in gunzip
* ext/zlib/zlib.c (zlib_gunzip): clear zstream to fix memory leak.
[ruby-core:83162] [Bug #13982]
zlib.c: ensure to free
* ext/zlib/zlib.c (zlib_gunzip): gz0 is a structure variable on
the stack, no longer valid after exit by an exception. ensure
to free instead. [Bug #13982]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62172 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 8ca14dafc8..b3feac2f3b 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 |