diff options
author | marius <marius@FreeBSD.org> | 2010-06-02 17:17:11 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2010-06-02 17:17:11 +0000 |
commit | f05cc30a988fbf6bb187c8f51e001af03f07472e (patch) | |
tree | 46dc1b22b56ac421ff3d4ecd15fcfd9a73262d30 /sys/geom | |
parent | 24ac89cf14c282421af2638eaf20a08c0649ab78 (diff) | |
download | FreeBSD-src-f05cc30a988fbf6bb187c8f51e001af03f07472e.zip FreeBSD-src-f05cc30a988fbf6bb187c8f51e001af03f07472e.tar.gz |
Don't leak memory on destruction.
Reviewed by: marcel
MFC after: 3 days
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/part/g_part_bsd.c | 6 | ||||
-rw-r--r-- | sys/geom/part/g_part_gpt.c | 6 |
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 e99f0bb..7e75199 100644 --- a/sys/geom/part/g_part_bsd.c +++ b/sys/geom/part/g_part_bsd.c @@ -240,6 +240,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 a6f7490..46a92ab 100644 --- a/sys/geom/part/g_part_gpt.c +++ b/sys/geom/part/g_part_gpt.c @@ -486,6 +486,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 |