summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/disksubr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c
index ba152aec806..d9f3f22fa51 100644
--- a/sys/arch/amd64/amd64/disksubr.c
+++ b/sys/arch/amd64/amd64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.45 2007/06/09 23:06:46 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.46 2007/06/12 20:57:42 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -333,7 +333,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *),
{
struct dos_partition dp[NDOSPART], *dp2;
struct disklabel *dlp;
- struct buf *bp;
+ struct buf *bp = NULL;
int error, dospartoff, cyl, i;
int ourpart = -1;
@@ -403,7 +403,9 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *),
error = biowait(bp);
done:
- bp->b_flags |= B_INVAL;
- brelse(bp);
+ if (bp) {
+ bp->b_flags |= B_INVAL;
+ brelse(bp);
+ }
return (error);
}