summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/string.c b/string.c
index 589c80088e..4e30cb338a 100644
--- a/string.c
+++ b/string.c
@@ -1401,10 +1401,12 @@ rb_str_times(VALUE str, VALUE times)
static VALUE
rb_str_format_m(VALUE str, VALUE arg)
{
- volatile VALUE tmp = rb_check_array_type(arg);
+ VALUE tmp = rb_check_array_type(arg);
if (!NIL_P(tmp)) {
- return rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+ VALUE rv = rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+ RB_GC_GUARD(tmp);
+ return rv;
}
return rb_str_format(1, &arg, str);
}