summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-06-08 15:07:35 +0000
committerjhb <jhb@FreeBSD.org>2009-06-08 15:07:35 +0000
commit7489960f548277e056a33adf325c1bfc8736c3bc (patch)
treed2127e081681ab3081f091cb38f4470697a1a41c
parent7b683068a3daa155a947e8e649c294c50a5bfaa2 (diff)
downloadFreeBSD-src-7489960f548277e056a33adf325c1bfc8736c3bc.zip
FreeBSD-src-7489960f548277e056a33adf325c1bfc8736c3bc.tar.gz
Don't attempt to free the GPT partition list for a disk with an empty GPT.
Submitted by: Yuri Pankov yuri.pankov of gmail MFC after: 3 days
-rw-r--r--sys/boot/i386/libi386/biosdisk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 84b58d6..b49d4e6e 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -990,7 +990,8 @@ bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev)
out:
if (error) {
- free(od->od_partitions);
+ if (od->od_nparts > 0)
+ free(od->od_partitions);
od->od_flags &= ~BD_GPTOK;
}
return (error);
@@ -1044,7 +1045,7 @@ bd_closedisk(struct open_disk *od)
delay(3000000);
#endif
#ifdef LOADER_GPT_SUPPORT
- if (od->od_flags & BD_GPTOK)
+ if (od->od_flags & BD_GPTOK && od->od_nparts > 0)
free(od->od_partitions);
#endif
free(od);
OpenPOWER on IntegriCloud