diff options
author | Gleydson Soares <gsoares@cvs.openbsd.org> | 2016-01-28 17:26:11 +0000 |
---|---|---|
committer | Gleydson Soares <gsoares@cvs.openbsd.org> | 2016-01-28 17:26:11 +0000 |
commit | 548a2b4655a2174ca2ba5f15851a1f78e735aec6 (patch) | |
tree | 4ae41898d6663c37257cdd8f3e09518ca71abe4e | |
parent | 67d98809be607bb87afb25ae8f95d64e18b1837e (diff) |
malloc(3) returns a pointer, so check against NULL, not 0. (No functional change)
OK millert@
-rw-r--r-- | sbin/newfs/mkfs.c | 4 | ||||
-rw-r--r-- | sbin/ping6/ping6.c | 4 | ||||
-rw-r--r-- | sbin/scsi/libscsi.c | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 6d75732459d..6937184ca65 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.94 2015/11/23 19:19:30 deraadt Exp $ */ +/* $OpenBSD: mkfs.c,v 1.95 2016/01/28 17:26:10 gsoares Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -549,7 +549,7 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo, mode_t mfsmode, iobufsize = SBLOCKSIZE + 3 * sblock.fs_bsize; else iobufsize = 4 * sblock.fs_bsize; - if ((iobuf = malloc(iobufsize)) == 0) + if ((iobuf = malloc(iobufsize)) == NULL) errx(38, "cannot allocate I/O buffer"); bzero(iobuf, iobufsize); /* diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 3fcce1f5429..53682c829c7 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping6.c,v 1.143 2015/11/29 22:41:20 florian Exp $ */ +/* $OpenBSD: ping6.c,v 1.144 2016/01/28 17:26:10 gsoares Exp $ */ /* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */ /* @@ -526,7 +526,7 @@ main(int argc, char *argv[]) if (hoplimit != -1) { /* set IP6 packet options */ - if ((scmsg = malloc( CMSG_SPACE(sizeof(int)))) == 0) + if ((scmsg = malloc( CMSG_SPACE(sizeof(int)))) == NULL) errx(1, "can't allocate enough memory"); smsghdr.msg_control = (caddr_t)scmsg; smsghdr.msg_controllen = CMSG_SPACE(sizeof(int)); diff --git a/sbin/scsi/libscsi.c b/sbin/scsi/libscsi.c index 1e394a6d07b..d7572f21e87 100644 --- a/sbin/scsi/libscsi.c +++ b/sbin/scsi/libscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: libscsi.c,v 1.10 2015/08/20 22:02:21 deraadt Exp $ */ +/* $OpenBSD: libscsi.c,v 1.11 2016/01/28 17:26:10 gsoares Exp $ */ /* Copyright (c) 1994 HD Associates * (contact: dufault@hda.com) @@ -701,7 +701,7 @@ scsireq_build(scsireq_t *scsireq, u_long datalen, caddr_t databuf, /* XXX: Good way to get a memory leak. Perhaps this should be * removed. */ - if ( (scsireq->databuf = malloc(datalen)) == 0) + if ( (scsireq->databuf = malloc(datalen)) == NULL) return 0; scsireq->datalen = datalen; @@ -739,7 +739,7 @@ scsireq_t /* XXX: Good way to get a memory leak. Perhaps this should be * removed. */ - if ( (scsireq->databuf = malloc(datalen)) == 0) + if ( (scsireq->databuf = malloc(datalen)) == NULL) return 0; scsireq->datalen = datalen; |