summaryrefslogtreecommitdiff
path: root/usr.bin/awk/lib.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-04 02:38:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-04 02:38:59 +0000
commit42fa94d17d8074f808122d9412cf257dac4d71aa (patch)
tree245c5ddeaedcd98bbf5e5257c003c4e7e4dc0362 /usr.bin/awk/lib.c
parent92809e364832a1206235fddb4b3432bda0b1d3c6 (diff)
catch malloc failures, my changes; found by cloder@acm.org
Diffstat (limited to 'usr.bin/awk/lib.c')
-rw-r--r--usr.bin/awk/lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c
index 24bbf169489..2e2ec08b547 100644
--- a/usr.bin/awk/lib.c
+++ b/usr.bin/awk/lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib.c,v 1.9 2001/11/05 09:58:13 deraadt Exp $ */
+/* $OpenBSD: lib.c,v 1.10 2002/07/04 02:38:58 deraadt Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -66,6 +66,8 @@ void recinit(unsigned int n)
FATAL("out of space for $0 and fields");
fldtab[0] = (Cell *) malloc(sizeof (Cell));
+ if (fldtab[0] == NULL)
+ FATAL("out of space for fields");
*fldtab[0] = dollar0;
fldtab[0]->sval = record;
fldtab[0]->nval = tostring("0");