mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (ruby_cleanup): use rb_ary_free to free internal object.
* gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free. [ruby-core:35192] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18364f541b
commit
96c078c340
5 changed files with 20 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Feb 11 19:45:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (ruby_cleanup): use rb_ary_free to free internal object.
|
||||
|
||||
* gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free.
|
||||
[ruby-core:35192]
|
||||
|
||||
Fri Feb 11 16:57:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_transcode.rb (test_from_cp50221): fix wrong
|
||||
|
|
2
eval.c
2
eval.c
|
@ -170,7 +170,7 @@ ruby_cleanup(volatile int ex)
|
|||
for (i=RARRAY_LEN(ary) - 1; i>=0; i--) {
|
||||
((void(*)(rb_vm_t*))RARRAY_PTR(ary)[i])(vm);
|
||||
}
|
||||
rb_ary_clear(ary);
|
||||
rb_ary_free(ary);
|
||||
|
||||
#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
|
||||
switch (ex) {
|
||||
|
|
2
gc.h
2
gc.h
|
@ -58,7 +58,7 @@ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
|
|||
#endif
|
||||
|
||||
#define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
|
||||
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);}
|
||||
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
|
||||
|
||||
#if STACK_GROW_DIRECTION > 0
|
||||
# define STACK_UPPER(x, a, b) (a)
|
||||
|
|
|
@ -384,7 +384,7 @@ class TestThread < Test::Unit::TestCase
|
|||
end
|
||||
INPUT
|
||||
|
||||
assert_in_out_err(%w(--disable-gems -d), <<-INPUT, %w(false 2), /.+/)
|
||||
assert_in_out_err(%w(--disable-gems -d), <<-INPUT, %w(false 2), %r".+")
|
||||
p Thread.abort_on_exception
|
||||
begin
|
||||
Thread.new { raise }
|
||||
|
@ -577,6 +577,15 @@ class TestThread < Test::Unit::TestCase
|
|||
assert_nothing_raised {arr.hash}
|
||||
assert(obj[:visited])
|
||||
end
|
||||
|
||||
def test_thread_instance_variable
|
||||
bug4389 = '[ruby-core:35192]'
|
||||
assert_in_out_err([], <<-INPUT, %w(), [], bug4389)
|
||||
class << Thread.current
|
||||
@data = :data
|
||||
end
|
||||
INPUT
|
||||
end
|
||||
end
|
||||
|
||||
class TestThreadGroup < Test::Unit::TestCase
|
||||
|
|
2
vm.c
2
vm.c
|
@ -230,7 +230,7 @@ env_free(void * const ptr)
|
|||
{
|
||||
RUBY_FREE_ENTER("env");
|
||||
if (ptr) {
|
||||
const rb_env_t * const env = ptr;
|
||||
rb_env_t *const env = ptr;
|
||||
RUBY_FREE_UNLESS_NULL(env->env);
|
||||
ruby_xfree(ptr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue