aboutsummaryrefslogtreecommitdiffstats
path: root/rational.c
diff options
context:
space:
mode:
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rational.c b/rational.c
index 439f9673da..f6c49fe516 100644
--- a/rational.c
+++ b/rational.c
@@ -261,10 +261,15 @@ rb_gcd_gmp(VALUE x, VALUE y)
mpz_gcd(mz, mx, my);
+ mpz_clear(mx);
+ mpz_clear(my);
+
zn = (mpz_sizeinbase(mz, 16) + SIZEOF_BDIGIT*2 - 1) / (SIZEOF_BDIGIT*2);
z = rb_big_new(zn, 1);
mpz_export(BIGNUM_DIGITS(z), &count, -1, sizeof(BDIGIT), 0, nails, mz);
+ mpz_clear(mz);
+
return rb_big_norm(z);
}
#endif