diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2009-10-16 12:15:04 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2009-10-16 12:15:04 +0000 |
commit | 7d672698297cd690f731fb42ff14a0e3ddb35755 (patch) | |
tree | fe02a524f7f5098071b58f8a2d7141fb1c30cf65 /lib/libc/gdtoa/hdtoa.c | |
parent | 261fc86bcfe671993b508087f8707ba7f1f1ad27 (diff) |
teach gdtoa & its subroutines that malloc can fail; in which case
ecvt, fcvt, gcvt, *printf, strtof, strtod, strtold act per ieee
1003.1. after these massive changes, remove unused files which
would not work now. reported by Maksymilian Arciemowicz; ok theo
Diffstat (limited to 'lib/libc/gdtoa/hdtoa.c')
-rw-r--r-- | lib/libc/gdtoa/hdtoa.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/gdtoa/hdtoa.c b/lib/libc/gdtoa/hdtoa.c index f841538a300..c62f6d5d390 100644 --- a/lib/libc/gdtoa/hdtoa.c +++ b/lib/libc/gdtoa/hdtoa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hdtoa.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/* $OpenBSD: hdtoa.c,v 1.2 2009/10/16 12:15:03 martynas Exp $ */ /*- * Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.ORG> * All rights reserved. @@ -162,6 +162,8 @@ __hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, */ bufsize = (sigfigs > ndigits) ? sigfigs : ndigits; s0 = rv_alloc(bufsize); + if (s0 == NULL) + return (NULL); /* * We work from right to left, first adding any requested zero @@ -257,6 +259,8 @@ __hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign, */ bufsize = (sigfigs > ndigits) ? sigfigs : ndigits; s0 = rv_alloc(bufsize); + if (s0 == NULL) + return (NULL); /* * We work from right to left, first adding any requested zero |