1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 14:30:34 +02:00

Fix memory leak in scm_from_{u,}int64 on 32-bit platforms

* libguile/conv-integer.i.c (SCM_FROM_TYPE_PROTO):
* libguile/conv-uinteger.i.c (SCM_FROM_TYPE_PROTO): Fix a big in which
  scm_from_int64 and scm_from_uint64 on a 32-bit platform leaked memory
  if they needed to allocate a bignum.  Fixes #20079.
This commit is contained in:
Andy Wingo 2016-06-23 14:57:50 +02:00
parent e7f1038aca
commit 2c8ea5a008
2 changed files with 2 additions and 2 deletions

View file

@ -117,7 +117,7 @@ SCM_FROM_TYPE_PROTO (TYPE val)
return scm_i_long2big (val);
else
{
SCM z = scm_double_cell (scm_tc16_big, 0, 0, 0);
SCM z = make_bignum ();
mpz_init (SCM_I_BIG_MPZ (z));
if (val < 0)
{

View file

@ -104,7 +104,7 @@ SCM_FROM_TYPE_PROTO (TYPE val)
return scm_i_ulong2big (val);
else
{
SCM z = scm_double_cell (scm_tc16_big, 0, 0, 0);
SCM z = make_bignum ();
mpz_init (SCM_I_BIG_MPZ (z));
mpz_import (SCM_I_BIG_MPZ (z), 1, 1, sizeof (TYPE), 0, 0, &val);
return z;