diff --git a/C/adtdefs.c b/C/adtdefs.c index 8495cc65b..e94502547 100644 --- a/C/adtdefs.c +++ b/C/adtdefs.c @@ -751,7 +751,7 @@ Yap_GetValue(Atom a) } #ifdef USE_GMP else { - out = Yap_MkBigIntTerm(Yap_BigIntOfTerm(out)); + out = Yap_MkBigIntTermCopy(Yap_BigIntOfTerm(out)); } #endif } diff --git a/C/arith1.c b/C/arith1.c index 42f45ee15..0f7d03ec7 100644 --- a/C/arith1.c +++ b/C/arith1.c @@ -101,7 +101,6 @@ EvalToTerm(blob_type f, union arith_ret *res) case big_int_e: { Term t = Yap_MkBigIntTerm(res->big); - mpz_clear(res->big); return t; } #endif diff --git a/H/arith2.h b/H/arith2.h index 0c9e1c0f5..4f305c2cd 100644 --- a/H/arith2.h +++ b/H/arith2.h @@ -688,7 +688,11 @@ p_times(Term t1, Term t2 E_ARGS) } case double_e: /* big * float */ - RFLOAT(mpz_get_d(v1.big)*v2.dbl); + { + Float dbl = mpz_get_d(v1.big)*v2.dbl; + mpz_clear(v1.big); + RFLOAT(dbl); + } case big_int_e: /* big * big */ { diff --git a/changes-5.1.html b/changes-5.1.html index a0ac5c848..2091e597f 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -16,7 +16,8 @@