From 9e880be27392a21d6f70ac024e9bdcd014525b7c Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 1 Dec 2000 09:59:40 +0000 Subject: Exit if malloc() returns NULL Submitted by: Chris Faulhaber --- bin/date/vary.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bin/date') diff --git a/bin/date/vary.c b/bin/date/vary.c index 7fba422..7ee8a4f 100644 --- a/bin/date/vary.c +++ b/bin/date/vary.c @@ -29,6 +29,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include #include #include #include @@ -93,7 +94,8 @@ vary_append(struct vary *v, char *arg) } else nextp = &result; - *nextp = (struct vary *)malloc(sizeof(struct vary)); + if ((*nextp = (struct vary *)malloc(sizeof(struct vary))) == NULL) + err(1, "malloc"); (*nextp)->arg = arg; (*nextp)->next = NULL; return result; -- cgit v1.1