summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index ede0de6523..b558ab3b29 100644
--- a/bignum.c
+++ b/bignum.c
@@ -734,6 +734,8 @@ rb_str_to_inum(VALUE str, int base, int badcheck)
{
char *s;
long len;
+ VALUE v = 0;
+ VALUE ret;
StringValue(str);
if (badcheck) {
@@ -745,14 +747,17 @@ rb_str_to_inum(VALUE str, int base, int badcheck)
if (s) {
len = RSTRING_LEN(str);
if (s[len]) { /* no sentinel somehow */
- char *p = ALLOCA_N(char, len+1);
+ char *p = ALLOCV(v, len+1);
MEMCPY(p, s, char, len);
p[len] = '\0';
s = p;
}
}
- return rb_cstr_to_inum(s, base, badcheck);
+ ret = rb_cstr_to_inum(s, base, badcheck);
+ if (v)
+ ALLOCV_END(v);
+ return ret;
}
#if HAVE_LONG_LONG