summaryrefslogtreecommitdiff
path: root/usr.sbin/mrinfo
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-10-16 06:23:34 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-10-16 06:23:34 +0000
commitcd68f9fd9f2baef40ae0855f613088ced5134c9a (patch)
tree4312704b4631eacd1b5bc2e9b96e0d48a13dcf49 /usr.sbin/mrinfo
parent085935061e167b3fd3dd1b293d15a23f832eec68 (diff)
check malloc() ret val!
Diffstat (limited to 'usr.sbin/mrinfo')
-rw-r--r--usr.sbin/mrinfo/mrinfo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c
index 692b5250326..5be11dcd36d 100644
--- a/usr.sbin/mrinfo/mrinfo.c
+++ b/usr.sbin/mrinfo/mrinfo.c
@@ -164,7 +164,7 @@ log(severity, syserr, format, va_alist)
strncat(fmt, format, 80);
vfprintf(stderr, fmt, ap);
if (syserr == 0)
- fprintf(stderr, "\n");
+ fputc('\n', stderr);
else if (syserr < sys_nerr)
fprintf(stderr, ": %s\n", sys_errlist[syserr]);
else
@@ -379,8 +379,10 @@ main(argc, argv)
if ((target_addr = inet_addr(host)) != -1) {
hp = &bogus;
hp->h_length = sizeof(target_addr);
- hp->h_addr_list = (char **)malloc(2 * sizeof(char *));
- hp->h_addr_list[0] = malloc(hp->h_length);
+ if (!(hp->h_addr_list = (char **)malloc(2 * sizeof(char *))))
+ err(1, "can't allocate memory");
+ if (!(hp->h_addr_list[0] = malloc(hp->h_length)))
+ err(1, "can't allocate memory");
memcpy(hp->h_addr_list[0], &target_addr, hp->h_length);
hp->h_addr_list[1] = 0;
} else