diff options
author | 2006-10-29 18:45:55 +0000 | |
---|---|---|
committer | 2006-10-29 18:45:55 +0000 | |
commit | 575363187b8d4227ad45d9eba18e69e123c9e936 (patch) | |
tree | d6ef99171b68a75dc0d95fedee3f2948388b2ea7 /lib/libc/stdlib/gcvt.c | |
parent | Fix TAILQ usage, preventing crashes (diff) | |
download | wireguard-openbsd-575363187b8d4227ad45d9eba18e69e123c9e936.tar.xz wireguard-openbsd-575363187b8d4227ad45d9eba18e69e123c9e936.zip |
make __dtoa & strtod() thread-safe useing the same method as newer gdtoa
codebase. tested mostly by ckuethe and myself. __dtoa() use now requires
a call to __freedtoa()
Diffstat (limited to 'lib/libc/stdlib/gcvt.c')
-rw-r--r-- | lib/libc/stdlib/gcvt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdlib/gcvt.c b/lib/libc/stdlib/gcvt.c index bc6295c03de..c24157e465a 100644 --- a/lib/libc/stdlib/gcvt.c +++ b/lib/libc/stdlib/gcvt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcvt.c,v 1.9 2006/01/10 16:18:37 millert Exp $ */ +/* $OpenBSD: gcvt.c,v 1.10 2006/10/29 18:45:56 deraadt Exp $ */ /* * Copyright (c) 2002, 2003, 2006 Todd C. Miller <Todd.Miller@courtesan.com> @@ -26,6 +26,7 @@ #include <string.h> extern char *__dtoa(double, int, int, int *, int *, char **); +extern void __freedtoa(char *); char * gcvt(double value, int ndigit, char *buf) @@ -48,6 +49,7 @@ gcvt(double value, int ndigit, char *buf) */ snprintf(buf, ndigit + 1, "%s%s", sign ? "-" : "", *digits == 'I' ? "inf" : "nan"); + __freedtoa(digits); return (buf); } @@ -104,5 +106,6 @@ gcvt(double value, int ndigit, char *buf) } *dst = '\0'; } + __freedtoa(digits); return (buf); } |