From aede99584cb0d715ac3f7c41068bc88f09d2a61b Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Sun, 29 Oct 2006 18:45:56 +0000 Subject: 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() --- src/lib/libc/stdlib/gcvt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/lib/libc/stdlib/gcvt.c') diff --git a/src/lib/libc/stdlib/gcvt.c b/src/lib/libc/stdlib/gcvt.c index bc6295c03d..c24157e465 100644 --- a/src/lib/libc/stdlib/gcvt.c +++ b/src/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 @@ -26,6 +26,7 @@ #include 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); } -- cgit v1.2.3-55-g6feb