diff options
author | Ruslan Ermilov <ru@FreeBSD.org> | 2010-03-30 13:46:40 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@FreeBSD.org> | 2010-03-30 13:46:40 +0000 |
commit | 53d55e97568b5b7f3bff1834b42f5fdc5d361c5a (patch) | |
tree | a397f140c6755a88a4687730d41abc1141ca66c4 /usr.sbin/config/lang.l | |
parent | 09bbda2122498276513a5aadf7a347a72bb4734b (diff) | |
download | src-53d55e97568b5b7f3bff1834b42f5fdc5d361c5a.tar.gz src-53d55e97568b5b7f3bff1834b42f5fdc5d361c5a.zip |
- Handle calloc() allocation failures.
- Fixed a comment.
- 2 -> EXIT_FAILURE in some places.
- errx() -> err() where appropriate.
PR: 144644
Submitted by: Garrett Cooper
Notes
Notes:
svn path=/head/; revision=205880
Diffstat (limited to 'usr.sbin/config/lang.l')
-rw-r--r-- | usr.sbin/config/lang.l | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index c7845cb0416d..4eb94da933f1 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -33,6 +33,7 @@ #include <assert.h> #include <ctype.h> +#include <err.h> #include <string.h> #include "y.tab.h" #include "config.h" @@ -220,6 +221,8 @@ cfgfile_add(const char *fname) struct cfgfile *cf; cf = calloc(1, sizeof(*cf)); + if (cf == NULL) + err(EXIT_FAILURE, "calloc"); assert(cf != NULL); asprintf(&cf->cfg_path, "%s", fname); STAILQ_INSERT_TAIL(&cfgfiles, cf, cfg_next); |