Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* 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
  • Loading branch information...
commit 96c078c34029bbc525085c4072b7e1ebcc9ec5a3 1 parent 18364f5
@nobu nobu authored
Showing with 20 additions and 4 deletions.
  1. +7 −0 ChangeLog
  2. +1 −1  eval.c
  3. +1 −1  gc.h
  4. +10 −1 test/ruby/test_thread.rb
  5. +1 −1  vm.c
View
7 ChangeLog
@@ -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
View
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) {
View
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)
View
11 test/ruby/test_thread.rb
@@ -384,7 +384,7 @@ def test_abort_on_exception
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 @@ def obj.hash
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
View
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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.