summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_strptime.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index e318af19f3..4f93219317 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -103,10 +103,12 @@ read_digits(const char *s, VALUE *n, size_t width)
return l;
}
else {
- char *s2 = ALLOCA_N(char, l + 1);
+ VALUE vbuf = 0;
+ char *s2 = ALLOCV_N(char, vbuf, l + 1);
memcpy(s2, s, l);
s2[l] = '\0';
*n = rb_cstr_to_inum(s2, 10, 0);
+ ALLOCV_END(vbuf);
return l;
}
}