guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/01: Fix memory leak in scm_from_{u, }int64 on 32-bit


From: Andy Wingo
Subject: [Guile-commits] 01/01: Fix memory leak in scm_from_{u, }int64 on 32-bit platforms
Date: Thu, 23 Jun 2016 12:59:25 +0000 (UTC)

wingo pushed a commit to branch master
in repository guile.

commit 2c8ea5a008959ffba629694942d75887dc14a869
Author: Andy Wingo <address@hidden>
Date:   Thu Jun 23 14:57:50 2016 +0200

    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.
---
 libguile/conv-integer.i.c  |    2 +-
 libguile/conv-uinteger.i.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libguile/conv-integer.i.c b/libguile/conv-integer.i.c
index 4cf887c..a5362d3 100644
--- a/libguile/conv-integer.i.c
+++ b/libguile/conv-integer.i.c
@@ -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)
        {
diff --git a/libguile/conv-uinteger.i.c b/libguile/conv-uinteger.i.c
index d6b969c..f62dc41 100644
--- a/libguile/conv-uinteger.i.c
+++ b/libguile/conv-uinteger.i.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]