Project

General

Profile

Actions

Bug #4389

closed

"pointer being freed was not allocated" error after setting instance variable in metaclass for Thread.current

Added by delano (Delano Mandelbaum) over 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2p136 (2010-12-25) [x86_64-darwin10.6.0]
Backport:
[ruby-core:35192]

Description

=begin
To recreate:

class Thread
def metaclass
class << self; self; end;
end
end
Thread.current.metaclass.instance_variable_set("@data", :data)
exit

Result:
ruby(28425,0x7fff70bc9ca0) malloc: *** error for object 0x100400000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Ruby 1.8.7, 1.9.1 are not affected.

Reproduced on:
Darwin hostname 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386
Linux hostname 2.6.32.16-linode28 #1 SMP Sun Jul 25 21:32:42 UTC 2010 i686 GNU/Linux
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #4828: crash in test_thread_instance_variableClosed06/05/2011Actions
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r30840.
Delano, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • 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]
    =end
Actions

Also available in: Atom PDF