summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-09-26 17:01:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-09-26 17:01:15 +0000
commitb8f26b523ff2b8845782957e48986dc4c9167225 (patch)
tree3513e582c958463a745650067698676d63885857
parent456be62e692ee84728c7a7283e4a5afb392772a6 (diff)
use emalloc and watch for strdup failure
-rw-r--r--usr.sbin/config/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 69f0e94ee4d..340dc2e62c7 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.32 2003/06/28 04:55:07 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.33 2003/09/26 17:01:14 deraadt Exp $ */
/* $NetBSD: main.c,v 1.22 1997/02/02 21:12:33 thorpej Exp $ */
/*
@@ -296,6 +296,8 @@ mksymlinks(void)
q = machinearch;
} else {
p = strdup("machine");
+ if (!p)
+ errx(1, "out of memory");
q = machine;
}
(void)unlink(q);
@@ -704,7 +706,7 @@ optiondelta(void)
for (nnewopts = 0, nv = options; nv != NULL; nv = nv->nv_next)
nnewopts++;
- newopts = (struct opt *)malloc(nnewopts * sizeof(struct opt));
+ newopts = (struct opt *)emalloc(nnewopts * sizeof(struct opt));
if (newopts == NULL)
ret = 0;
for (i = 0, nv = options; nv != NULL; nv = nv->nv_next, i++) {