diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-11 21:23:30 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-11 21:23:30 +0000 |
commit | 364af8a6959831d6abf08c4be270fc8fa36a3558 (patch) | |
tree | 209a46d0ba7282ded089f4ffe251892d7784dc03 /sbin/fdisk/disk.c | |
parent | 442fb3a9589843c4a2efce416f37fb12e8dddb5b (diff) |
malloc() failure tests; rimshot@pandora.be
Diffstat (limited to 'sbin/fdisk/disk.c')
-rw-r--r-- | sbin/fdisk/disk.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index 7d48cd711e9..86fce510a27 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.15 2002/04/25 22:13:13 espie Exp $ */ +/* $OpenBSD: disk.c,v 1.16 2002/07/11 21:23:28 deraadt Exp $ */ /* * Copyright (c) 1997, 2001 Tobias Weingartner @@ -92,6 +92,8 @@ DISK_getlabelmetrics(name) /* Get label metrics */ if ((fd = DISK_open(name, O_RDONLY)) != -1) { lm = malloc(sizeof(DISK_metrics)); + if (lm == NULL) + err(1, "malloc"); if (ioctl(fd, DIOCGDINFO, &dl) == -1) { warn("DIOCGDINFO"); @@ -154,6 +156,8 @@ DISK_getbiosmetrics(name) } bm = malloc(sizeof(di)); + if (bm == NULL) + err(1, "malloc"); bm->cylinders = di.bios_cylinders; bm->heads = di.bios_heads; bm->sectors = di.bios_sectors; |