Skip to content

Commit 6af475d

Browse files
authored
Add RB_GC_GUARD to test-only methods (#378)
1 parent 922fa0a commit 6af475d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/bigdecimal/bigdecimal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,6 +4227,8 @@ BigDecimal_vpdivd(VALUE self, VALUE r, VALUE cprec) {
42274227
VpDivd(c.real, d.real, a.real, b.real);
42284228
VpNmlz(c.real);
42294229
VpNmlz(d.real);
4230+
RB_GC_GUARD(a.bigdecimal);
4231+
RB_GC_GUARD(b.bigdecimal);
42304232
return rb_assoc_new(c.bigdecimal, d.bigdecimal);
42314233
}
42324234

@@ -4239,6 +4241,8 @@ BigDecimal_vpmult(VALUE self, VALUE v) {
42394241
c = NewZeroWrapLimited(1, cn * BASE_FIG);
42404242
VpMult(c.real, a.real, b.real);
42414243
VpNmlz(c.real);
4244+
RB_GC_GUARD(a.bigdecimal);
4245+
RB_GC_GUARD(b.bigdecimal);
42424246
return c.bigdecimal;
42434247
}
42444248
#endif /* BIGDECIMAL_USE_VP_TEST_METHODS */

0 commit comments

Comments
 (0)