diff options
author | brian <brian@FreeBSD.org> | 1997-05-10 01:22:19 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-05-10 01:22:19 +0000 |
commit | 82bac13560d095243e9988bfb770da73089749c1 (patch) | |
tree | 262cfd051516c08f29f6f133a950e9de9f2d42fd /usr.sbin/ppp/mbuf.c | |
parent | 1da867bda76bc701006945dfbc4733f550c91c2d (diff) | |
download | FreeBSD-src-82bac13560d095243e9988bfb770da73089749c1.zip FreeBSD-src-82bac13560d095243e9988bfb770da73089749c1.tar.gz |
Tidy up the code - bounds checking, return
value checking etc.
Submitted by: eivind
Diffstat (limited to 'usr.sbin/ppp/mbuf.c')
-rw-r--r-- | usr.sbin/ppp/mbuf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/ppp/mbuf.c b/usr.sbin/ppp/mbuf.c index e3d9004..7454726 100644 --- a/usr.sbin/ppp/mbuf.c +++ b/usr.sbin/ppp/mbuf.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id$ + * $Id: mbuf.c,v 1.5 1997/02/22 16:10:34 peter Exp $ * */ #include "defs.h" @@ -51,8 +51,18 @@ int type; if (type > MB_MAX) logprintf("bad type %d\n", type); bp = (struct mbuf *)malloc(sizeof(struct mbuf)); + if (bp == NULL) { + logprintf("failed to allocate memory: %u\n", sizeof(struct mbuf)); + fprintf(stderr,"failed to allocate memory: %u\n", sizeof(struct mbuf)); + exit(0); + } bzero(bp, sizeof(struct mbuf)); p = (u_char *)malloc(cnt); + if (p == NULL) { + logprintf("failed to allocate memory: %d\n", cnt); + fprintf(stderr,"failed to allocate memory: %d\n", cnt); + exit(0); + } MemMap[type].count += cnt; totalalloced += cnt; bp->base = p; |