diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-12-01 09:59:40 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-12-01 09:59:40 +0000 |
commit | 6e4cd31d99135e6e7da9973d600ba81288416380 (patch) | |
tree | 10aba1878b4a2a609a7e97c95535c74adeb20cc1 /bin/date | |
parent | 1533a5cfd2424825ae48dfaaab03f4980dd79cb4 (diff) | |
download | src-6e4cd31d99135e6e7da9973d600ba81288416380.tar.gz src-6e4cd31d99135e6e7da9973d600ba81288416380.zip |
Exit if malloc() returns NULL
Submitted by: Chris Faulhaber <jedgar@fxp.org>
Notes
Notes:
svn path=/head/; revision=69457
Diffstat (limited to 'bin/date')
-rw-r--r-- | bin/date/vary.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 <err.h> #include <time.h> #include <string.h> #include <stdlib.h> @@ -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; |