summaryrefslogtreecommitdiff
path: root/lib/libc/gdtoa/sum.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gdtoa/sum.c')
-rw-r--r--lib/libc/gdtoa/sum.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/gdtoa/sum.c b/lib/libc/gdtoa/sum.c
index dc0c88bcfab..c6eb954f044 100644
--- a/lib/libc/gdtoa/sum.c
+++ b/lib/libc/gdtoa/sum.c
@@ -48,6 +48,8 @@ sum(Bigint *a, Bigint *b)
c = b; b = a; a = c;
}
c = Balloc(a->k);
+ if (c == NULL)
+ return (NULL);
c->wds = a->wds;
carry = 0;
xa = a->x;
@@ -88,6 +90,8 @@ sum(Bigint *a, Bigint *b)
if (carry) {
if (c->wds == c->maxwds) {
b = Balloc(c->k + 1);
+ if (b == NULL)
+ return (NULL);
Bcopy(b, c);
Bfree(c);
c = b;