ruby-changes:23009
From: yugui <ko1@a...>
Date: Fri, 16 Mar 2012 14:45:48 +0900 (JST)
Subject: [ruby-changes:23009] yugui:r35058 (trunk): * load.c (ruby_init_ext): don't free the given pointer itself.
yugui 2012-03-16 14:45:39 +0900 (Fri, 16 Mar 2012) New Revision: 35058 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35058 Log: * load.c (ruby_init_ext): don't free the given pointer itself. It is not guaranteed even that the pointer is on heap. Modified files: trunk/ChangeLog trunk/load.c Index: ChangeLog =================================================================== --- ChangeLog (revision 35057) +++ ChangeLog (revision 35058) @@ -1,3 +1,8 @@ +Fri Mar 16 14:43:18 2012 Yuki Sonoda (Yugui) <yugui@y...> + + * load.c (ruby_init_ext): don't free the given pointer itself. + It is not guaranteed even that the pointer is on heap. + Fri Mar 16 14:37:57 2012 Shugo Maeda <shugo@r...> * vm_eval.c (rb_mod_module_eval): fix the documentation of Index: load.c =================================================================== --- load.c (revision 35057) +++ load.c (revision 35058) @@ -681,11 +681,12 @@ RUBY_FUNC_EXPORTED void ruby_init_ext(const char *name, void (*init)(void)) { - if (load_lock(name)) { + char* const lock_key = load_lock(name); + if (lock_key) { rb_vm_call_cfunc(rb_vm_top_self(), init_ext_call, (VALUE)init, 0, rb_str_new2(name)); rb_provide(name); - load_unlock(name, 1); + load_unlock(lock_key, 1); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/