diff options
author | brian <brian@FreeBSD.org> | 2000-12-01 09:59:40 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2000-12-01 09:59:40 +0000 |
commit | 9e880be27392a21d6f70ac024e9bdcd014525b7c (patch) | |
tree | 8e6983240f7b0a8fbd47d95021c2854aeaff9838 /bin/date | |
parent | 2387a635e49bd664b8532cda3cd9fd6fb5d9d891 (diff) | |
download | FreeBSD-src-9e880be27392a21d6f70ac024e9bdcd014525b7c.zip FreeBSD-src-9e880be27392a21d6f70ac024e9bdcd014525b7c.tar.gz |
Exit if malloc() returns NULL
Submitted by: Chris Faulhaber <jedgar@fxp.org>
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 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 <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; |