HCoop
/
bpt
/
guile.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
76f3ee7
)
fix `free' of mpz_to_str
author
Andy Wingo
<wingo@pobox.com>
Fri, 2 Dec 2011 18:18:05 +0000
(19:18 +0100)
committer
Andy Wingo
<wingo@pobox.com>
Fri, 2 Dec 2011 18:18:05 +0000
(19:18 +0100)
* libguile/numbers.c (scm_number_to_string): Don't `free' the result of
mpz_get_str; use the mp free function.
libguile/numbers.c
patch
|
blob
|
blame
|
history
diff --git
a/libguile/numbers.c
b/libguile/numbers.c
index
e5b4ed9
..
6938381
100644
(file)
--- a/
libguile/numbers.c
+++ b/
libguile/numbers.c
@@
-5330,8
+5330,14
@@
SCM_DEFINE (scm_number_to_string, "number->string", 1, 1, 0,
else if (SCM_BIGP (n))
{
char *str = mpz_get_str (NULL, base, SCM_I_BIG_MPZ (n));
+ size_t len = strlen (str);
+ void (*freefunc) (void *, size_t);
+ SCM ret;
+ mp_get_memory_functions (NULL, NULL, &freefunc);
scm_remember_upto_here_1 (n);
- return scm_take_locale_string (str);
+ ret = scm_from_latin1_stringn (str, len);
+ freefunc (str, len + 1);
+ return ret;
}
else if (SCM_FRACTIONP (n))
{