summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-05 02:01:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-05 02:01:29 +0000
commit62b89f1a61f66a0a9e9189f42a12f293aadd32a8 (patch)
tree672fa34cc86280ad9a562f628aed6e44af15e852 /error.c
parentb83fc8735f306bccaa6b50b15fd1718698d2d630 (diff)
* error.c (rb_name_err_mesg_new): guard mesg, recv and method.
The problem in [ruby-dev:41464] is caused because mesg is collected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/error.c b/error.c
index d5589ccdaf..85f4c2a1be 100644
--- a/error.c
+++ b/error.c
@@ -825,11 +825,16 @@ VALUE
rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
{
VALUE *ptr = ALLOC_N(VALUE, NAME_ERR_MESG_COUNT);
+ VALUE result;
ptr[0] = mesg;
ptr[1] = recv;
ptr[2] = method;
- return TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+ result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+ RB_GC_GUARD(mesg);
+ RB_GC_GUARD(recv);
+ RB_GC_GUARD(method);
+ return result;
}
/* :nodoc: */