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/dmisc.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/dmisc.c')
-rw-r--r-- | lib/libc/gdtoa/dmisc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/gdtoa/dmisc.c b/lib/libc/gdtoa/dmisc.c index ce170c733bf..585cbfc9a56 100644 --- a/lib/libc/gdtoa/dmisc.c +++ b/lib/libc/gdtoa/dmisc.c @@ -50,6 +50,12 @@ rv_alloc(int i) j <<= 1) k++; r = (int*)Balloc(k); + if (r == NULL) + return ( +#ifndef MULTIPLE_THREADS + dtoa_result = +#endif + NULL); *r = k; return #ifndef MULTIPLE_THREADS @@ -68,6 +74,8 @@ nrv_alloc(char *s, char **rve, int n) char *rv, *t; t = rv = rv_alloc(n); + if (t == NULL) + return NULL; while((*t = *s++) !=0) t++; if (rve) |