summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/print.c b/src/print.c
index 824f8d75779..49d9e38e7d3 100644
--- a/src/print.c
+++ b/src/print.c
@@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "sysstdio.h"
#include "lisp.h"
+#include "bignum.h"
#include "character.h"
#include "coding.h"
#include "buffer.h"
@@ -1369,10 +1370,12 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
{
case PVEC_BIGNUM:
{
- struct Lisp_Bignum *b = XBIGNUM (obj);
- char *str = mpz_get_str (NULL, 10, b->value);
- record_unwind_protect_ptr (xfree, str);
+ USE_SAFE_ALLOCA;
+ char *str = SAFE_ALLOCA (mpz_sizeinbase (XBIGNUM (obj)->value, 10)
+ + 2);
+ mpz_get_str (str, 10, XBIGNUM (obj)->value);
print_c_string (str, printcharfun);
+ SAFE_FREE ();
}
break;