diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-25 13:31:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-25 13:31:34 +0000 |
commit | 4198f1473ab7e34780db04155d01f6cc573f07c6 (patch) | |
tree | fb56045a0886f2a0f40553b81c96e7379bb02967 /test/ruby/test_env.rb | |
parent | e1884ec8206916ede741d17ecf3a1748b954e274 (diff) | |
download | ruby-4198f1473ab7e34780db04155d01f6cc573f07c6.tar.gz |
hash.c: fix memory leak
* hash.c (ruby_setenv): fix memory leak on Windows, free
environment strings block after check for the size.
[ruby-dev:48323] [Bug #9977]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_env.rb')
-rw-r--r-- | test/ruby/test_env.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 41d1ccf306..ecf0608ec6 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutil' class TestEnv < Test::Unit::TestCase IGNORE_CASE = /bccwin|mswin|mingw/ =~ RUBY_PLATFORM @@ -507,4 +508,13 @@ class TestEnv < Test::Unit::TestCase end.call end end + + def test_memory_leak_aset + bug9977 = '[ruby-dev:48323] [Bug #9977]' + assert_no_memory_leak([], <<-'end;', "5_000.times {ENV[k] = v}", bug9977) + ENV.clear + k = 'FOO' + v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + end; + end end |