mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-28 11:57:28 +00:00
Exit if malloc() returns NULL
Submitted by: Chris Faulhaber <jedgar@fxp.org>
This commit is contained in:
parent
1533a5cfd2
commit
6e4cd31d99
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69457
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user