summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 05:45:39 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 05:45:39 +0000
commita157c85a7f1e6e11399c682218a60ebcdd093686 (patch)
tree2e2e4baed6f2a6e5b9703f64a61d824de4dc59d7 /load.c
parent58d1b85c78df06ca734dcb266d4d8ec17f7bdd39 (diff)
* load.c (ruby_init_ext): don't free the given pointer itself.
It is not guaranteed even that the pointer is on heap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/load.c b/load.c
index 18651dd3a2..a320c51fc4 100644
--- a/load.c
+++ b/load.c
@@ -681,11 +681,12 @@ init_ext_call(VALUE arg)
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);
}
}