summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-05 05:40:17 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-05 05:40:17 (GMT)
commitb55217c691ba454def6dc9adb5541f6d2b69e381 (patch)
treecf2a77073a398484e4551d5f38a5c890115b7ec3 /transcode.c
parent3969b1861c344fd37c1c6f59499836c849f098d7 (diff)
transcode.c: GC guards
* transcode.c (econv_init): add guards to prevent source encoding name and destination encoding name from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/transcode.c b/transcode.c
index 25527e1..d5add7b 100644
--- a/transcode.c
+++ b/transcode.c
@@ -3391,7 +3391,10 @@ econv_init(int argc, VALUE *argv, VALUE self)
}
if (!ec) {
- rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags));
+ VALUE exc = rb_econv_open_exc(sname, dname, ecflags);
+ RB_GC_GUARD(snamev);
+ RB_GC_GUARD(dnamev);
+ rb_exc_raise(exc);
}
if (!DECORATOR_P(sname, dname)) {
@@ -3399,6 +3402,8 @@ econv_init(int argc, VALUE *argv, VALUE self)
senc = make_dummy_encoding(sname);
if (!denc)
denc = make_dummy_encoding(dname);
+ RB_GC_GUARD(snamev);
+ RB_GC_GUARD(dnamev);
}
ec->source_encoding = senc;