From b1da166ef18e69f6b6575af8a95d08aa5884623a Mon Sep 17 00:00:00 2001 From: "Andrey V. Elsukov" Date: Sat, 25 Sep 2010 18:27:29 +0000 Subject: [PATCH] Some schemes can allocate memory for internal purposes but when GEOM does withering this memory doesn't freed. Add G_PART_DESTROY call to g_part_wither. Also add missed g_free() call to G_PART_READ method for MBR and PC98 schemes. Submitted by: jh (previous version) Reviewed by: pjd Approved by: kib (mentor) --- sys/geom/part/g_part.c | 1 + sys/geom/part/g_part_mbr.c | 1 + sys/geom/part/g_part_pc98.c | 1 + 3 files changed, 3 insertions(+) diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index cd1979bb4d9..9e7c9c02708 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -1273,6 +1273,7 @@ g_part_wither(struct g_geom *gp, int error) table = gp->softc; if (table != NULL) { + G_PART_DESTROY(table, NULL); while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) { LIST_REMOVE(entry, gpe_entry); g_free(entry); diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c index 6cc6245ca74..c006c59938a 100644 --- a/sys/geom/part/g_part_mbr.c +++ b/sys/geom/part/g_part_mbr.c @@ -465,6 +465,7 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp) basetable->gpt_first = basetable->gpt_sectors; basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1; + g_free(buf); return (0); } diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c index ab83662a4f9..a4235d6a776 100644 --- a/sys/geom/part/g_part_pc98.c +++ b/sys/geom/part/g_part_pc98.c @@ -458,6 +458,7 @@ g_part_pc98_read(struct g_part_table *basetable, struct g_consumer *cp) basetable->gpt_first = cyl; basetable->gpt_last = msize - (msize % cyl) - 1; + g_free(buf); return (0); }