diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-02-18 12:12:21 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-02-18 12:12:21 +0000 |
commit | 9885105786ab8a968511c8ed077b6dff137506ba (patch) | |
tree | 2d1d9865dc02782675aa750f9d078fe5f383eaee /out_str.c | |
parent | 017d73c4dc7aea0664c4c52d5cfdfe4cfbdd364f (diff) | |
download | mpfr-9885105786ab8a968511c8ed077b6dff137506ba.tar.gz |
size of freed block by __gmp_free_func was wrong
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1002 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'out_str.c')
-rw-r--r-- | out_str.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -56,16 +56,20 @@ mpfr_out_str (stream, base, n_digits, op, rnd_mode) s0 = s; /* for op=3.1416 we have s = "31416" and e = 1 */ - l = strlen(s)+1; - if (*s == '-') fputc(*s++, stream); + l = strlen (s) + 1; /* size of allocated block returned by mpfr_get_str */ + if (*s == '-') + fputc (*s++, stream); - fputc(*s++, stream); e--; /* writes leading digit */ - fputc('.', stream); /* decimal point */ - fputs(s, stream); /* rest of mantissa */ + /* outputs mantissa */ + fputc (*s++, stream); e--; /* leading digit */ + fputc ('.', stream); /* decimal point */ + fputs (s, stream); /* rest of mantissa */ + (*__gmp_free_func) (s0, l); + + /* outputs exponent */ if (e) { l += fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), e); } - (*__gmp_free_func)(s0, l); return l; } |