diff options
author | 2014-06-25 18:21:24 +0000 | |
---|---|---|
committer | 2014-06-25 18:21:24 +0000 | |
commit | 6ea8b240a4c07c78390b4b6ff531820d051389f7 (patch) | |
tree | fb319c59fd4c5743bd01fae1f72e91f8d2f753c0 | |
parent | AT_BASE returns us the *address* of the start of ld.so, so (diff) | |
download | wireguard-openbsd-6ea8b240a4c07c78390b4b6ff531820d051389f7.tar.xz wireguard-openbsd-6ea8b240a4c07c78390b4b6ff531820d051389f7.zip |
Check malloc return value for NULL.
ok jsing@
-rw-r--r-- | usr.sbin/installboot/i386_installboot.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/installboot/i386_installboot.c b/usr.sbin/installboot/i386_installboot.c index ad1d65c4ff0..d75793e283b 100644 --- a/usr.sbin/installboot/i386_installboot.c +++ b/usr.sbin/installboot/i386_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i386_installboot.c,v 1.3 2014/06/09 15:50:08 jsing Exp $ */ +/* $OpenBSD: i386_installboot.c,v 1.4 2014/06/25 18:21:24 tobias Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -230,7 +230,8 @@ again: (mbroff == DOSBBSECTOR) ? "master" : "extended", (mbroff == DOSBBSECTOR) ? 'M' : 'E', mbroff); - secbuf = malloc(dl->d_secsize); + if ((secbuf = malloc(dl->d_secsize)) == NULL) + err(1, NULL); if (lseek(devfd, (off_t)mbroff * dl->d_secsize, SEEK_SET) < 0 || read(devfd, secbuf, dl->d_secsize) < (ssize_t)sizeof(mbr)) err(4, "can't read boot record"); |