aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2010-06-11 21:54:04 +0000
committerMarius Strobl <marius@FreeBSD.org>2010-06-11 21:54:04 +0000
commit2ff16af07da48e1a0aae0bf19209a80e75ab249e (patch)
tree90a08b31da095c9736cad483176004b1d185aa90
parentcd89751f90eaa4f92a910c032fcc605357253acd (diff)
downloadsrc-2ff16af07da48e1a0aae0bf19209a80e75ab249e.tar.gz
src-2ff16af07da48e1a0aae0bf19209a80e75ab249e.zip
MFC: r208746
Don't leak memory on destruction. Reviewed by: marcel Approved by: re (kib)
Notes
Notes: svn path=/stable/8/; revision=209073
-rw-r--r--sys/geom/part/g_part_bsd.c6
-rw-r--r--sys/geom/part/g_part_gpt.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/geom/part/g_part_bsd.c b/sys/geom/part/g_part_bsd.c
index b476bfd83ece..82e6bcb3ebe2 100644
--- a/sys/geom/part/g_part_bsd.c
+++ b/sys/geom/part/g_part_bsd.c
@@ -239,6 +239,12 @@ g_part_bsd_create(struct g_part_table *basetable, struct g_part_parms *gpp)
static int
g_part_bsd_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
{
+ struct g_part_bsd_table *table;
+
+ table = (struct g_part_bsd_table *)basetable;
+ if (table->bbarea != NULL)
+ g_free(table->bbarea);
+ table->bbarea = NULL;
/* Wipe the second sector to clear the partitioning. */
basetable->gpt_smhead |= 2;
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index a689862e6837..7347ca5e5777 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -462,6 +462,12 @@ g_part_gpt_create(struct g_part_table *basetable, struct g_part_parms *gpp)
static int
g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
{
+ struct g_part_gpt_table *table;
+
+ table = (struct g_part_gpt_table *)basetable;
+ if (table->hdr != NULL)
+ g_free(table->hdr);
+ table->hdr = NULL;
/*
* Wipe the first 2 sectors as well as the last to clear the