diff --git a/bin/date/vary.c b/bin/date/vary.c index 7fba4221116b..7ee8a4fe8d90 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;