diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-01-19 16:06:06 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-01-19 16:06:06 +0000 |
commit | 8f42c813a0defdb15100ea4e5113186d80390544 (patch) | |
tree | 5bb25242c23a0aaacdbe56b3ff5b3d34867a487d /usr.sbin/syslogd | |
parent | b2af054673cbad3ad6aa62215a739997b121d4ae (diff) |
Check malloc() return value. Pointed out by mpech@. Ok mpech@, deraadt@
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 27d41634f84..e92662e54c3 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.73 2004/01/13 04:08:27 djm Exp $ */ +/* $OpenBSD: syslogd.c,v 1.74 2004/01/19 16:06:05 millert Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -39,7 +39,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #else -static const char rcsid[] = "$OpenBSD: syslogd.c,v 1.73 2004/01/13 04:08:27 djm Exp $"; +static const char rcsid[] = "$OpenBSD: syslogd.c,v 1.74 2004/01/19 16:06:05 millert Exp $"; #endif #endif /* not lint */ @@ -321,7 +321,10 @@ main(int argc, char *argv[]) if (linesize < MAXLINE) linesize = MAXLINE; linesize++; - line = malloc(linesize); + if ((line = malloc(linesize)) == NULL) { + logerror("Couldn't allocate line buffer"); + die(0); + } /* Clear poll array, set all fds to ignore */ for (i = 0; i < N_PFD; i++) { |