1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) r45350: [Backport #9645]

* variable.c (rb_const_set): delete existing entry on redefinition
	  [Bug #9645]

	* test/ruby/test_const.rb (test_redefinition): test for leak


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-06-01 16:55:58 +00:00
parent fca433e2fd
commit 5a22835c22
4 changed files with 20 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Mon Jun 2 01:46:43 2014 Eric Wong <e@80x24.org>
* variable.c (rb_const_set): delete existing entry on redefinition
[Bug #9645]
* test/ruby/test_const.rb (test_redefinition): test for leak
Fri May 30 00:13:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (setup_exception): preserve errinfo across calling #to_s

View file

@ -1,5 +1,6 @@
# -*- coding: us-ascii -*-
require 'test/unit'
require_relative 'envutil'
class TestConst < Test::Unit::TestCase
TEST1 = 1
@ -54,5 +55,12 @@ class TestConst < Test::Unit::TestCase
#{__FILE__}:#{__LINE__-1}: warning: already initialized constant #{c}::X
#{__FILE__}:#{__LINE__-3}: warning: previous definition of X was here
WARNING
code = <<-PRE
olderr = $stderr.dup
$stderr.reopen(File::NULL, "wb")
350000.times { FOO = :BAR }
$stderr.reopen(olderr)
PRE
assert_no_memory_leak([], '', code, 'redefined constant')
end
end

View file

@ -2203,6 +2203,8 @@ rb_const_set(VALUE klass, ID id, VALUE val)
rb_compile_warn(RSTRING_PTR(ce->file), ce->line,
"previous definition of %"PRIsVALUE" was here", name);
}
st_delete(RCLASS_CONST_TBL(klass), &id, 0);
xfree(ce);
}
}
}

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-05-30"
#define RUBY_PATCHLEVEL 117
#define RUBY_RELEASE_DATE "2014-06-02"
#define RUBY_PATCHLEVEL 118
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 30
#define RUBY_RELEASE_MONTH 6
#define RUBY_RELEASE_DAY 2
#include "ruby/version.h"